Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC16F84 AT Keyboard emulator

Status
Not open for further replies.

rbairos

New Member
Hi, Im trying to buid a circuit which monitors several switches and
sends the result to the AT-keyboard input on my PC.

Ive heard that only two lines of a pic can be used to create
a full bi-directional interface but all the examples I can find on google
use 4 lines. Does anyone have any clues or examples how I can
use only 2?

Also, Ive tried a send-only version of the circuit, which sends scan
codes for a singe letter once every second or so.
The PC receives the first character, but then only beeps at every subsequent transmission from my PIC.
Is this even possible, or do I need full bi-directional communication
for this simple test?

Thanks very much,
Rob.
 
**broken link removed**

PS/2 keyboard or mouse is an open collector bus. so some systems use 2 pins per signal, one to pull it low when needed and one to read the actual status of the signal. This for both clock and data makes 4 wires.

but by playing around with the pic's TRIS registers you can do it using only 2 pins, The site above contains samples
 
Ive looked through that site quite a bit, and Im not sure If I need
to use PORTB with programmable internal pull-up resistors or not.

Right now Im stuck using two lines on PORTA with external pullup resistors.

I use the TRIS command, but essentially the pullups are always present.
Does that sound okay?
 
Yes, that's the way a open collector bus works. When you want to put a '1' on a line you make that pin an input, it then has a high impedance. The pull-up resistors will pull the line high. When you want to put a '0' on a line you make the line an output and drive it low.
 
Okay, thats what Im currently doing.
I was a little worried looking at all the 4-line schematics
including extra transistors and diodes.
My board has none of that (and no room left either!)
 
Okay, Ive now figured out some stuff. I seem to be able to send
strings of bytes, and receive at least one byte, using only two
PORTA lines on the pic. (Ive added a 5.5K pullup resistor to each).

However, Im having trouble decoding messages sent from the PC.
Namely, status led messages. I have my scope on it, and it
seems the data line is never pulled low from the PC in certain situations.
(Any message which turns off all keyboard leds)

Thanks for any clues, source code, etc.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top