Hi everyone,
The plan is to try to upgrade my non HID-compliant mouse so that it uses the PS/2 interface. I've spent a few hours looking at the protocol and have mocked up a first attempt at bitbanging the protocol. The code below should send a single byte to the computer and will hopefully develop into sending more useful information like keyboard AT commands (keyboard emulation seems a lot more simple so I think I'll start there).
Currently I would like someone wise in the ways of bitbanging to have a look at the code and see if it is feasable to work, although I'm still open to general help with the task. I will be able to test by the weekend as I need to grab my old mouse from my other house and steal the PS/2 cable from it.
I would rather not hack into an old PS/2 mouse as I would much prefer a PICAXE solution, even though it would be easier.
Many thanks,
Jamster
The plan is to try to upgrade my non HID-compliant mouse so that it uses the PS/2 interface. I've spent a few hours looking at the protocol and have mocked up a first attempt at bitbanging the protocol. The code below should send a single byte to the computer and will hopefully develop into sending more useful information like keyboard AT commands (keyboard emulation seems a lot more simple so I think I'll start there).
Currently I would like someone wise in the ways of bitbanging to have a look at the code and see if it is feasable to work, although I'm still open to general help with the task. I will be able to test by the weekend as I need to grab my old mouse from my other house and steal the PS/2 cable from it.
Code:
SYMBOL CLKpin = pin2
SYMBOL CLK = 2
SYMBOL DataPin = 0
SYMBOL varout = b0
sendPS2:
if CLKpin = 1 then 'CLK must be high to send data.
low DataPin
pulsout CLK,2 'Tell PC we're sending data
for b1=0 to 7 'send data:
b2 = varout & 1 'mask bit (%?xxxxxxx)
if b2 = 1 then 'change DataPin accordingly
high DataPin
else
low DataPin
endif
pulsout CLK,2 'Tell pc to read bit
varout = varout / 2 'shift variable right
next b1
b2 = varout % 2 'Decide parity
if b2 = 0 then
high DataPin
else
low DataPin
endif
pulsout CLK,2 'Tell PC to read parity
high DataPin
pulsout CLK,2 'Stop bit
else
goto sendPS2 'If CLK wasn't high keep waiting.
endif
Many thanks,
Jamster