"ps2dev.h" Usage?

I am not clear on the read and write functions of the ps2dev,h file and .ccp example.

I have an industrial device, (not a PC), that uses a standard (though obsolete) PC PS2 keyboard as a remote control device for it's physical control panel. So I want to emulate a PS2 keyboard so I can send the Arduino RS232 commands and the Arduino then sends PS2 commands to the device's PS2 port thinking that the Arduino is a PC keyboard.

Which would I use "read" or "write"? It's not clear if which direction is to what, the keyboard or the computer?

I also assume the PS2 library performs the ASCII to Scan Code conversion? So sending an 'A' is the same as would be pressing an upper case A?

Actually the target Arduino will have four PS2 ports that will send to one of four attached devices depending on the RS232 command but I know how to code all that. I wouls just change the DATA and CLOCK pin assignment in a case loop depending on which PS2 port I want to use.

Just out of curiosity - which arduino has four PS2 ports?

The Arduino Uno board has at least 8 I/O lines, you can easily set up four independent PS2 ports off the stock Uno board. PS2 signals are just 5v TTL typically driven by open collector drivers with pullups but for one to one, standard TTL/CMOS outputs will also work.

In theory, any pin (two pins?) can be used for PS2 (the keyboard/mouse protocol, not the playstation protocol.) I think the common libraries want the clock pin to be an interrupt, but that shouldn't be necessary (and might not be required for emulating a device. My only experience with with the PC side (non-interrupt based PS/2 implementation here!)

"I think the common libraries want the clock pin to be an interrupt,"

That may required for the Arduino to read keyboard commands but I would think it should not be required for the Arduino to transmit PS2 commands? Unless it needs an acknowledge. I'll have to study the library code unless somebody can shed more light in this.

EDIT: The polled version you mentioned looks a lot simpler for what I am trying to do, just send simple keyboard characters. I'll give it a try - thanks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.