Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
And as I said the TX seems to works, it's just the RX from the controller that seems to be failing.
(And as far as the 'double-forum' thing goes, I figured different people visit different forums. Get better coverage, and a possible answer. If that was taboo, then I apologize)
#define PSclock 3 // PA3 blue wire#define PSdata 4 // PA4 brown#define PSacknowledge 5 // PA5 green#define PScommand 6 // PA6 orange#define PSattention 7 // PA7 yellow... // PSx controller I/O pin setup: sbi(DDRA, PSclock); // clock. output. (blue) cbi(DDRA, PSdata); // data. input. (brown) sbi(PORTA, PSdata); // enable pullup resistor cbi(DDRA, PSacknowledge); // acknowledge. input. (green) sbi(PORTA, PSacknowledge); // enable pullup resistor sbi(DDRA, PScommand); // command. output. (orange) sbi(DDRA, PSattention); // attention. output. (yellow)
int gameByte(short int command){ short int i ; delay_us(1); short int data = 0x00; // clear data variable to save setting low bits later. for(i=0;i<8;i++) { if(command & _BV(i)) sbi(PORTA, PScommand); // bit bang "command" out on PScommand wire. else cbi(PORTA, PScommand); cbi(PORTA, PSclock); // CLOCK LOW delay_us(1); // wait for output to stabilise sbi(PORTA, PSclock); // CLOCK HIGH if((PINA & _BV(PSdata))) {sbi(data, i);} // read PSdata pin and store //else {cbi(data, i);} } sbi(PORTA, PScommand); delay_us(20); // wait for ACK to pass. return(data);}