| ??? 12/04/02 06:59 Read: times |
#33722 - RE: 8052 Joystick Control? |
Sorry I'm posting here, I just thought that maybe it would be good since I have a question concerning an 8051/pc joystick interface that I kept it under this topic.
Switches on the pc joystick are easy enough, but the direction pad (stick) was a little harder. I opted to use a pair of 555's instead of the typical 558 since I had them handy and don't plan on using more than one joystick. Suffice it to say, hardware is up and operational, now on to the code. My scope tells me that left yields a 23 microsecond pulse, no direction (not pressed) gives a 0.6 millisecond pulse, and right produces a 1.15 millisecond pulse. All the PC game programming books tell me to just trigger the timer and sit and count in a loop until the pulse goes back low and I've gotten my count. For the 23 microsecond pulse I'd consider doing this. But using this same approach with the longer pulse of the right direction seems like an awful long time to sit there wasting time. I am considering connecting the 555 outputs to the 8051 external interrupt lines, grabbing the current timer when I initiate a sample, and doing the math once I get the second timer value in the interrupt. (I realize there are a couple of special cases to account for here such as timer overflow/reload) Am I wrong to believe that 1 to 1.5 milliseconds is precious processing time that can't be spared? |
| Topic | Author | Date |
| 8052 Joystick Control? | 01/01/70 00:00 | |
RE: 8052 Joystick Control? | 01/01/70 00:00 |



