Going Postal: Clacks Towers - Step 2: Sending Binary
So the last post, I was able to at least test to see that the keyboard was working properly. Today I wanted to work more on trying to get the keyboard sending information to LEDs.
So connected I have the keyboard to the Parallax Demo Board. Then I have an NPN8 kit (one of our new kits) which allows you to send signals through a shift register (serial to parallel) and output onto 8 separate channels - in this case LEDs!
The NPN8 Kit has 5 connections on one side (from right to left) : Power, GND, Clock, Latch, Serial (In the Port In section). Pins 0-7 on the Port In side connect to the emitters of the transistors and Pins 0-7 on the Port Out side connect to the collectors of the transistors.
So from right to left in Port In: 3.3V, Ground, and put Clock, Latch, and Serial on Propeller Demo Board pins 2, 1, and 0 respectively (just because of how the wiring went).
Using the Tymkrs Shift Me example code (another kit), and with the help of Whisker, we shortened it and incorporated it into the keyboard code:
http://pastebin.com/FmiHMVmm
It essentially sets Latch, Clock, and Serial as outputs. Then looks at the keyboard. If a key is pressed, the key's information gets passed into variable Index as a long (32 bits). I left a debug line there so that if you wanted to see your typing on the serial terminal, you could.
Then I directed the Propeller to examine this variable Index, specifically bits 0 to 7. I then told it to send bits 0 to 7 out on Serial to the shift register.
Note, remember shift registers (serial to parallel), take 8 bits in serially, and pass them out in a parallel fashion. To do so, you send in a bit, the clock has to go high then low, rinse repeat. When you are ready to release the stored inforation, the latch has to go high then low.
Then as mentioned before, I sent in a bit, set the Clock to high, then low. And after 8 bits, set the Latch to high, then low. This process tells the shift register to release its stored bits. So whatever you typed, essentially shows up on the LEDs!
The board above is a TTL8, another upcoming kit and allowed me to test with the LEDs, on the board, whether the keyboard was sending the correct information and whether the LEDs were lighting up appropriately. The way it functions is pretty much the same as the NPN8. Only difference is instead of driving 8 transistors which drive the LEDs, the TTL8 board drives the LEDs directly from the shift register.
http://tymkrs.tumblr.com/post/53522451066/tymkrs-shift-me-chainable-shift-register-header-kit <-- for more information on how shift registers work.
IT WORKS! Now for cosmetics!!!
@atdiy/@tymkrs














