LCD Serial Terminal
This small PC board is the terminal itself. Someday I will document a PC board design, but currently I am only making available the schematic diagram, source code for the PIC16F84, and compiled hex code for a typical configuration so you can quickly test it out. The source code is in C and very easily configured for different baud rates, LCD and keypad configurations. The program should be compiled with Hi-Tech PICC. A free version supporting the PIC16F84 called “PICLITE” is available and works fine.
The mapping of the keys is fully configurable, and each key can also be configured for one of four different modes. Each key is allowed to have a primary code and a secondary code. Depending on what mode is chosen, the secondary code might be sent when the key is released, or when the key is held more than one second, etc. Key repeat is also programmable, and each key can have a different mode.
Many cursor movement features are implemented, all the standard ones (backspace, carriage return etc.) and if you tell the program your LCD format, text will flow from line to line.
Every pin of the PIC16F84 is used, and some pins are used for 4 functions, through multiplexing the LCD, keyboard drive, and auxiliary input and output, using a feature I call “supermultiplexing”. I intended the auxiliary outputs to drive LEDs. The picture above shows a terminal mounted in a computer’s drive bay, see the five LEDs on the right side. The LEDs are time-sliced, so the pins are not dedicated all the time, so the LEDs will show a faint glimmer when off. Nonetheless, it’s a useful feature. Auxiliary inputs should be connected through a 10K resistor and will read high if left floating. One PIC pin is completely free and is configured as an output. The source code is easily modified if you need more pins and can sacrifice keypad columns.
The circuit requires a 5 volt DC power supply at a few milliamps. Although the PIC16F84 can run from 4 to 6 volts, the LCD contrast varies wildly with voltage. In the schematic I have shown LCD pin 3, the contrast pin, grounded. This might give you too dark a display. Connect it to ground through a 470 Ohm or 1K ohm resistor to lighten the display.
RS-232 is supposed to have +12 and -12 volts. This circuit does neither. Driving long, noisy lines could be troublesome. The receive pin is a Schmitt Trigger so it should reject most sources of noise, but if you have problems you could terminate it with a 4.7K resistor to ground at the board.
Supermultiplexing is not shown on the schematic. It is available on 5 pins (RB3-7). For output, connect LEDs through resistors(minimum 220 Ohms). The are commanded with control-P followed by the binary pattern you wish to output. The upper 5 bits of the byte you send will be output, and the lowest bit is sent out RB0. The other two bits are ignored. For input, hook to pins RB3 through RB7 through 10K resistors. You can use switches to ground, sense logic levels, or even sense 12 volt logic in an automotive application. Read the pins with control-N. A byte will be sent out showing the state of PORTB. The bottom 3 bits are not cleared so you should ignore them.
The source code is heavily commented so you should consult it before asking questions!
Timing is based on the crystal. You may substitute a ceramic resonator instead of a crystal, the accuracy of a resonator is adequate. Although a PIC can use an RC oscillator, it should not be used in this circuit, your baud rate would not be accurate. Use a crystal or resonator.
Frequently asked Questions:
Copyright © 1995-2002 Bob Blick. All Rights Reserved.
[ About me
| Acronyms | CW
| Data Sheets | Docs
| Download | E-mail
| HOME | Ham
projects | Hobby circuits
| Photo galery | PIC
Sign in my guestbook | View my guestbook ]
© 2001 - YO5OFH, Csaba Gajdos