So I'm attempting to use a ps/2 keyboard wired directly into a 28X1 chip for a project I'm working on. There are 10k-ohm pull-up resistors on the data and clock lines, and all of the connections appear solid (I measured them with an ohm-meter). It is powered either off of a 5V bench supply or 3xAAA batteries. The keyboard seems to randomly "freeze up" though, where it will work for the first 5-10 keystrokes, then apparently stop transmitting data (checked on an oscilloscope). Sometimes it will start up again and work for another 5-10 keystrokes, but it usually seems to eventually freeze up for good. I changed the keyboard for one from a project where it had been wired into an 18X (and working fine last time i had checked), and even with this new keyboard I'm seeing the exact same behavior.
This is the code running on the 28x1 (another 28x1 can read/write to the first "status" byte to reset it so it can accept another character)
Does anyone have any suggestions for what might be causing this behavior?
This is the code running on the 28x1 (another 28x1 can read/write to the first "status" byte to reset it so it can accept another character)
Code:
startup:
put 0,0
hi2csetup i2cslave,%11100000
main:
kbin [400,kbtimeout],b0 'grab one character
get 0,b1
if b1=1 then main 'if status=ready, discard character
put 1,b0 'if status <> ready, store character
put 0,1 'update status=ready
pause 400
kbtimeout:
goto main