Re: PIC, Keyboard, and USART
- From: Jan Wagner <nospam@xxxxxxxxxx>
- Date: Sun, 26 Mar 2006 14:04:20 +0300
Abstract Dissonance wrote:
I'm going to try to program a simple keyboard translator using the PIC2455 which has a built in EUSART. At this point I just want to get the keyboard codes into the pic and I just want to run this by you guys to make sure I'm on the right track.
1. Setup hardware. Basicaly just have to connect the Data and Clock lines to the EUSART pins on the pic
2. Enable the USART on the pic for Asynchronous mode and enable auto baud rate dection(to make it easy).
3. Read the RCREG in the interrupt and do whatever with it(like make an LED blink on certain codes).
Is that basicaly all I have to do? Do I need to use pullups or anything when connecting the lines or even use transistors to source/sink more current?
(I'm running the keyboard off a 5V supply that can source up to .5mA or so)
Apart from the "writing bugs" others already commented on, doing this with UART could be a real nightmare. Ok, 9600 baud and 8 databit, 1 odd parity, 1 start and 1 stop bit, and separate clock input, it is basically easy (if your microcontroller supports that many bits!! 11 of them). But then there is also the bidirectional communication needed especially if you want to configure the keyboard to something sensible by sending commands to it. Basically you'd have to switch off the UART and put the pins into output mode for the handshakes etc, then switch back to UART again to receive or transmit. For both receive /and/ transmit, you'd have to use the clock provided by the keyboard, i.e. synchronous UART. It's a real mess.
You can find some valuable background info at
http://www.beyondlogic.org/keyboard/keybrd.htm#1
If you only want to receive, and your uC does support full 11 bits UART ("Enhanced USART" sounds like it might, but then maybe that's just marketing bull...) then this should be very easy to do.
Just add the pull-up resistors, data line to UART RX, clock input not strictly necessary - until you want to transmit.
regards,
- Jan
.
- Follow-Ups:
- Re: PIC, Keyboard, and USART
- From: Abstract Dissonance
- Re: PIC, Keyboard, and USART
- References:
- PIC, Keyboard, and USART
- From: Abstract Dissonance
- PIC, Keyboard, and USART
- Prev by Date: Re: SCR question
- Next by Date: Re: Simple circuit to generate 12VDC from a 9v battery?
- Previous by thread: Re: PIC, Keyboard, and USART
- Next by thread: Re: PIC, Keyboard, and USART
- Index(es):
Relevant Pages
|
Loading