Pages: [1]   Go Down
Author Topic: PS/2 keyboard and oscilloscope connection?  (Read 610 times)
0 Members and 1 Guest are viewing this topic.
geo. area called Italia
Offline Offline
Full Member
***
Karma: 0
Posts: 190
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

greets

I want to connect a ps/2 keyboard to an oscilloscope but can't find the info on how to do it. Can you guys help?

thanks
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 64
Posts: 6055
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What do you mean by connect?

What are you trying to do?
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

geo. area called Italia
Offline Offline
Full Member
***
Karma: 0
Posts: 190
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi

I just want the scope to display the data that the keyboard sends when a key is hit.
The keyboard is powered with 5V from a USB adapter. Do I ignore the clock wire and just connect the scope's probe to the ps/2 data wire and the the ground clip to the ground wire from the USB power adapter?
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 64
Posts: 6055
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You could always try.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Worst state in America
Offline Offline
God Member
*****
Karma: 24
Posts: 672
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi

I just want the scope to display the data that the keyboard sends when a key is hit.
The keyboard is powered with 5V from a USB adapter. Do I ignore the clock wire and just connect the scope's probe to the ps/2 data wire and the the ground clip to the ground wire from the USB power adapter?

First of all, simply looking at the data line and ignoring the clock line will tell you nothing.

You need to know which bit is high or low with each clock transition.

Secondly, a PS-2 keyboard has open collector (open drain?) outputs. They need pullup resistors (4.7K would be fine).

Best bet is to connect the keyboard to a shift register and see what bytes come out with each keystroke (or hook it to an Arduino and use it as a data recorder).

I think there is even a PS/2 keyboard reading sketch or library available here. Check it out.
Logged

geo. area called Italia
Offline Offline
Full Member
***
Karma: 0
Posts: 190
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
First of all, simply looking at the data line and ignoring the clock line will tell you nothing.

does the clock run at constant baud rate?

Quote
Best bet is to connect the keyboard to a shift register and see what bytes come out with each keystroke (or hook it to an Arduino and use it as a data recorder).

I think there is even a PS/2 keyboard reading sketch or library available here. Check it out.

Yep, I tried that sketch, works fine with the Arduino, but with the scope I don't know what to do with the clock line, where to hook it up.

Logged

Worst state in America
Offline Offline
God Member
*****
Karma: 24
Posts: 672
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
First of all, simply looking at the data line and ignoring the clock line will tell you nothing.

does the clock run at constant baud rate?

Quote
Best bet is to connect the keyboard to a shift register and see what bytes come out with each keystroke (or hook it to an Arduino and use it as a data recorder).

I think there is even a PS/2 keyboard reading sketch or library available here. Check it out.

Yep, I tried that sketch, works fine with the Arduino, but with the scope I don't know what to do with the clock line, where to hook it up.



The PS/2 keyboard clock has a nominal frequency, but it's not critical (and it varies between keyboards). The concept of "baud rate" really doesn't apply here. The data is clocked out in sync with the clock line. When you detect the proper edge of the clock and then sample the data line, that is your zero or one. The actual speed ("baud rate") at which it comes out is irrelevant.

Also, the clock line doesn't constantly output a signal. It only sends a burst (one clock for each data bit) for every keystroke. And, each key has an "up" and "down" keycode. That's how you combine keys.

For example, if you hit CTRL, then C, the keyboard doesn't output a control-C, it outputs "Control key down, C key down" and it's up to you to determine that this combination means "ctrl-c".

The nice thing about this method is that virtually any key combination can be used. You can do "control-shift-alt-space-X" if you want to... just keep track of what key is up or down.

For more info, look here: http://www.computer-engineering.org/ps2protocol
Logged

geo. area called Italia
Offline Offline
Full Member
***
Karma: 0
Posts: 190
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Also, the clock line doesn't constantly output a signal. It only sends a burst (one clock for each data bit) for every keystroke. And, each key has an "up" and "down" keycode. That's how you combine keys.

So basically you could use one channel of the scope to display the data bits and another channel to display the clock data? (in square wave form).


---

This is a pic from the link you posted:



if I understand correctly I would connect the ground clip from the scope to the ground of the circuit (emitters) and the probe to the data pin?
Logged

Pages: [1]   Go Up
Jump to: