Nope. You basically "sit and rotate"... Let me explain, the keyboard line has a data and a clock line. It is controlled by the keyboard clock. I don't remember, but I believe the data is valid on a high to low transition of the clock. This can be confirmed with a Google search. You will also need to know whether the data is clocked in MSB, or LSB first. The shiftin subroutine waits for the clock line to go low(?), puts the data state into the lowest bit of your variable,if MSB,and shift the variable one position to the left. This is followed by a wait for the clock line to go back high, and it is done 7 more times. You can do this in a for next loop, and the code is pretty simple.Originally Posted by Kamikaze47
FOR A = 1 to 8
loop1: IF clock = 1 then loop1
Key_data.0 = dataline
Key_data = Key_data *2 ; Shift once to left
loop2: IF clock = 0 then loop2
Next A
Key_data now contains the keypress value. It is not the neat Ascii representation of the character you pressed. Nooooo....Lest it be that simple! Now you must use a lookup table with the proper characters in the right order, but when you are done, you will have the right character. Right? Unless you want upper and lower case. You will have to look at the shift keypress characters and see if they are being held down, or if caps lock has been engaged. Let's not even talk about the "extended characters"!
Have fun,
Ron




Bookmarks