There is a small microcontroller inside which converts signals sent from the calculator into control signals for a data selector (multiplexer). This selects which button to read. The output of this is fed back into the calculator. The calculator needs to run some code to be able to read the keystrokes. This code is easy to implement into existing games (hint hint)

The calculator runs code to pull down the one line of the I/O port (1->port) then the AtTiny45 MCU @1MHz inside the gamepad increases the value of a counter. The binairy value is then used to control a multiplexer via a 3 bits wide control bus. All of the buttons are hooked up to the multiplexer. The output of the multiplexer is fed back into the calculator's I/O port. After a short delay the calculator reads the port value. This corresponds with a keypress or not.

At the moment there are some mechanical issues with the gamepad (bad contacts and bad solder connections). Also: it is very time consuming to fit everything inside the gamepad. I had to mod the plastic casing a bit to make everything fit. I might want to make converter boxes/adapters instead.


Code to read keystrokes:

Code:
Lbl RKEYS
For(r1,0,7
1->port
Pause 1
If port=0
1->{GDB1+r1}
Else
0->{GDB1+r1}
End
2->port
Pause 2
End

After a delay of PAUSE 16 the microcontroller times out and resets the counter. In further revisions this delay can be decreased if necessary.
If you're pulsing a line to switch which multiplexed line you're reading, how do you know where the reset is? Do you at least use the other data line to reset the counter or something?

Edit: Oh, I see the line at the end. But why not use the second (unused?) data line for that?
KermMartian wrote:
If you're pulsing a line to switch which multiplexed line you're reading, how do you know where the reset is? Do you at least use the other data line to reset the counter or something?

Edit: Oh, I see the line at the end. But why not use the second (unused?) data line for that?

The second data line is for receiving data directly from the multiplexers output as it is not processed by the microcontroller (no spare pins left). I could have added a latch, but I wanted to keep the parts count as low as possible. At the moment I only have 4 parts:
AtTiny45
4051 multiplexer
Switch
Battery
The pullup resistors are on the board of the gamepad itself. I figured that the programmers would read the keypresses every cycle of the program loop and store them in an array. Reset is not needed.
I agree that reset wouldn't need to be used often, but I would want the peace of mind of knowing that I was indeed incrementing to the key I thought I was incrementing to. Smile
Would it be possible to do the opposite: use your calculator as a gamepad?
blue_bear_94 wrote:
Would it be possible to do the opposite: use your calculator as a gamepad?
It definitely would, and it's something that people like BrandonW have experimented with in the past. With clever ASM, the TI-84+/SE can be made to look like a USB gamepad to a computer.
How about using it as a keypad for the emulator? Very Happy Very Happy Very Happy
keoni29 wrote:
How about using it as a keypad for the emulator? Very Happy Very Happy Very Happy
Both BrandonW and Benryves have done that, as far as I know. I'd have to track down the page(s) on their respective websites.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement