Nigel's Menu

Nigel Goodwin's Website

Ju Jitsu
Lower Pilsley

LCD meter, using a single PIC.

I've had a lot of feedback about my original LCD meter project, and I've emailed the original software to a number of people who asked for it. However, the project never got completed - basically because MicroChip brought out new PIC's which rendered the original project obsolete. Whereas the original project used a 16F84 and a 12C672, the more modern 16F818/9 provides 10 bit A2D in the same 18 bit package as the 16F84 uses, and also has an internal oscillator - removing the need for a crystal and associated capacitors.

This makes the entire project even simpler, reducing it to the LCD display, one 16F818/9, one potentiometer, one decoupling capacitor, and (optionally) a TL341 voltage reference and feed resistor. It also makes the software simpler, as we don't need to communicate between the two IC's. My newer LCD routines are much improved, working in 4 bit mode and using hardware timing, rather than simple delay timing - this ensures the LCD routines are as fast as possible. The routines are actually those I developed for my PIC Tutorials at, and the entire meter software is based on the analogue to digital converter tutorial on those pages.

This is the circuit of the display board, as you can see it uses very few components, just the LCD module itself, a PIC16C84, a 4MHz crystal and associated capacitors, and a potentiometer - used for setting the display contrast. The RTCC (RA4) pin is used to input the serial data, RA3 is the only pin left free. Not shown on this circuit is an electrolytic capacitor I fitted across the supply rails, although PIC's seem to work well without them I usually hang one across - in this case it was a small tantalum capacitor that I had to hand - it can be seen in the first photo below, just to the right of the 16C84. If you feed the serial input via a 22K resistor, you could connect this directly to an RS232 line, and monitor the data on the line.

The display is fed in 8 bit mode, to use 4 bit mode pins 6, 7, 8, and 9 of the display should be disconnected from the PIC and connected to ground, this would free an extra four I/O pins, and I may well rewrite the software to take account of that.

The analogue to digital board is even simpler, the 12C672 has an in-built 4MHz oscillator, avoiding the need for those components, so it consists  almost solely of the PIC - the two presets are only for testing, providing varying voltages for the two channels. The TL341 is a 2.5V precision voltage reference, used as the reference voltage for the A2D converter in the chip, this gives a stable reference voltage, and avoids errors due to supply voltage changes. R1 provides the required current for the voltage reference, and give roughly 1mA through the device. As the TL341 gives a 2.5V reference, I've added R2 and R3 to form a potential divider to bring the range back to 5V - by changing the values you could read any voltage, but below 2.5V FSD would require amplifying first.
The two boards connected together, the right hand board is the 12C672, the two presets are for adjusting the input voltages for test purposes.
A closer shot of the display, it's currently running in 8 bit mode, which leaves 2 I/O pins unused, one is used for the serial input from the 12C672, and the other is spare - I may use it to switch the display to HEX mode, showing the Hexadecimal values of the incoming data, I've already got the required routines written in the chip, I used them during testing.

The software in the 12C672 reads the first input (AD0) and then multiples the result by 195 to scale  the 0-255 result to 0-50000, the resulting value is then converted into a decimal string, with the lowest two digits discarded. The decimal numbers are next converted to their ASCII codes, a decimal point added, and the data sent out as standard 9600baud serial data, cursor positioning commands are also added to the data stream, and the various text additions as seen in the pictures. Once AD0 has finished, the same is done for AD2, and the program then loops back to the start to give continuous updates.

The 16C84 reads the data stream, and displays the incoming data, the cursor positioning commands are striped out and processed separately - command and display functions are driven separately on these LCD modules. In order to detect command data, I first send a non-printing character (in this case 0x80) followed by the required data byte - the 16C84 detects the 0x80 and jumps to a command routine which send the following byte to the display as a command.

I'll be adding the software listings once I've decided exactly what I want to do, I'm open to any suggestions?.

Last Updated 16/12/03

Designed for 800x600
using IE4 or higher

Download IE4

You can reach me by email at:
[Main][Software][Satellite][Ju Jitsu][Misc]
[Links][Files][PicList][Lower Pilsley][Cybot]
[Projects][View my Guestbook][Sign my Guestbook]