|
|
Project in progress - an LCD meter, using PIC's.
This
ongoing project uses an EPROM technology PIC, the 12C672, as an eight
bit analogue to digital converter, it has up to four analogue inputs, but
this design currently uses only two of them.
I've
got a couple of different schemes in mind with this project, firstly using
just the 12C672 (the gold coloured UV erasable chip on the right of the
first picture) to feed into a PC serial port, allowing data logging and
plotting of graphs etc. I've written the software in the 12C672 so it can
feed directly to a PC serial port, so it could make a very simple
low cost device. The battery discharge curves on my Misc pages were
plotted in a similar way, using an old hardware A2D connected to the PC
parallel port.
Secondly,
as in the picture, using a 16C84 to feed an LCD display module, the 16C84
accepts the serial data from the 12C672 and displays it on the LCD - you
could use this to simultaneously display upto four different readings, for
example in a dual channel power supply, showing voltage and current for
both channels.
 |
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?.
|