#define strobe 3 //PORTD#define clk 4#define data 2void setup() {DDRD = 1 | (1<<strobe) | (1<<clk); // NES outputs}void pulse_pin(byte pin, byte del) {PORTD |= (1<<pin); //setdelayMicroseconds(del);PORTD &= ~(1<<pin); //cleardelayMicroseconds(del);}void loop() {byte btns = 0;pulse_pin(strobe, 10); //latch the controllerfor(int i = 0; i < 8; i++) { //read 8 bitsbtns = btns << 1 | !(PIND & (1<<data));pulse_pin(clk, 10); //clock next bit}// atari output d12-d8, open collectorDDRB = (btns & 0xf) | (!!(btns & 0xc0) << 4); // dpad + A||B}
Sunday, June 21, 2020
DIY NES to Atari Controller Adapter
I wanted to use my favorite NES controller with my controller-less Atari 65XE and 130XE. The NES controller uses a shift register, while the Atari expects 5 simple buttons. I wrote a simple Arduino program to convert one to the other. Using an Arduino mini, it fits in this little inline enclosure.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment