thank you ralph for the reply
what i'm not sure :
- i need no external hardware, or?
- i can realise the software with shiftout?
thank you ralph for the reply
what i'm not sure :
- i need no external hardware, or?
- i can realise the software with shiftout?
mischl,
this is probably the link you are after
regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
ralph, thanks for the help.
i've looked for many sites and found asm as well bs examples. i read a lot about protocols and test my own code. because i have several problems and i'm a bit confused my question : has anybody else a piece of code which send at-keyboard commands to pc host?
if it is only a piece to test, it would me helps a lot
thanks for a support
I had a PS/2 KB emulator running a few weeks ago. I don't have the code right in front of me, but I wrote it all in PBP.
You can use the SHIFTOUT command with no problems - just tell shiftout to only send 9 bits instead of 16.
Don't forget to calculate the parity bit (odd) and tack it on at the end.
Clock and data both idle high, so make sure you use pullup resistors.
I'll dig around and see if I can find the code later this afternoon.
John
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
hello john
thanks for your support.
i work with a similar code. so i have some additional questions :
- which osc speed do you use? - i have a 16f876 with 4M
- have you defined a shift_pauseus? - i try it . around 40us seems best
- how long do you wait until you send the release code (F0) after the button press comand? - i don't wait
- how looks your hardware setup? - 2 transistors at portc with pull up works at best. nod good because i get different chars... when i only take pullups instead the transisitors, after connect the keyboard it wouldn't be initialized.
- what are you doing at the booting from the pc?
best regards
- which osc speed do you use? - i have a 16f876 with 4M
'628 @ 20 MHz
- have you defined a shift_pauseus? - i try it . around 40us seems best
I used 50 uS
- how long do you wait until you send the release code (F0) after the button press comand? - i don't wait
In my particular application, I sent a 'make' code at keydown and a 'break' code at keyup. So the waiting time was up to the buttonpusher.
- how looks your hardware setup? - 2 transistors at portc with pull up works at best. nod good because i get different chars... when i only take pullups instead the transisitors, after connect the keyboard it wouldn't be initialized.
Just a pair of 4K7 pullup resistors on clock and data. The pins on my pic are set to be inputs (high impedence) unless I'm transmitting.
- what are you doing at the booting from the pc?
My project doesn't so far parse all of the boot communication which takes place, because it's only used after Windows has totally started.
I'd started to send copies of the incoming data out to a terminal program so I could see what was being said, but didn't spend much time there due to other projects.
However, one of the documents mentioned earlier in this thread has a fairly detailed description of the commands and responses that will be flying around on a properly configured system.
Sorry I can't help much more.
John
Bookmarks