Here's a code snippet to transmit PS/2 data:
In this case, dataout is an array of bytes I may want to send to the computer.
Odd parity is NOT the value of all bits XOR'ed together.
Good luck!
John
* * *
for x = 0 to 7
if dataout[x] <> 0 then
sendthis = dataout[x]
parity = not(sendthis.0 ^^ sendthis.1 ^^ sendthis.2 ^^ sendthis.3 ^^ sendthis.4 ^^ sendthis.5 ^^ sendthis.6 ^^ sendthis.7)
sendthis = sendthis << 1 'move over to insert start bit
sendthis.0 = 0 'start bit
sendthis.9 = parity
sendthis.10 = 1 'stop bit
shiftout kbddata,kbdclk,4,[sendthis\11]
dataout[x] = 0
endif
next x
Bookmarks