I'm trying to simulate (emulate) a ps/2 keyboard from a pic to laptop's ps/2 port. The PIC (12F509) needs to send a few keystrokes to the laptop.
Using a part of JEC's code i got it working, but the output (e.g. what i see on my notepad on my laptop screen does not look like the characters i should be seeing, when i look at various scan code tables.
What am i doing wrong ?
Here's the code :
Code:
INCLUDE "modedefs.bas"
DEFINE SHIFT_PAUSEUS 50
'==== Andere test ! ============================================================
parity var word
sendthis vaR word
kbddata var GPIO.0
kbdclk var GPIO.1
start:
high kbddata
high kbdclk
pause 500
sendthis = %11010110 'sending this results in a "y" on screen
gosub calsub
sendthis = %11110000 'This should be 0xF0 the "release code"
gosub calsub
sendthis = %11010110 'For release code
gosub calsub
goto start
calsub
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 = 1 'start bit 'In JEC's code this was a 0, but that did'nt work
sendthis.9 = parity
sendthis.10 = 0 'stop bit 'In JEC's code this was a 1, but that did'nt work
shiftout kbddata,kbdclk,4,[sendthis\11]
return
goto start
The "y" i got when i was experimenting, other thing i saw was :
11000111 = 3
11000110 = DEL
00010010 = o
11010110 = y
00110010 = F4
11011110 = NUM-LOCK
11110110 = PAGE-UP
What is wrong ???
Best Regards, UB
Bookmarks