Feb 4, 2010

Reading the data output from cheap digital verniers and scales


The circuit make good use of the on-chip comparator in a single 12F675 PIC to detect the low level data and clock signals from the scales.

The firmware reads both 24 bit binary and 7 digit BCD output scales types, can switch the scale to fast or slow reading, zero the scale display and outputs the data in an easily readable format at 115,200 Baud.

Scale Reader
Reading the data output from cheap digital verniers and scales.
Circuit description:


The Vcc(+1v5) , Clock and Data signals from the scale are connected to the PIC via 3k3 current limiting resisters, red LEDs are used to limit the voltage to about 1.2 volt.

The circuit connects to a PC comport, stealing power from the RTS output and a negative bias from the DTR output. A series diode and 470R resister with a 4v7 zener is used to limit the power supply to less than 5v for the PIC. A universal PNP transistor inverts the serial output from the PIC its collector is biased negative from the PC’s DTR output.

Note:
The scale’s Vcc (+1.5 volt) is connected to the vernier/scale body so care should be taken not to short circuit the PC ground to the vernier body.

Firmware:

The firmware communicates with the PC at 115,200 baud (8,n,1) using a two byte command line interpreter. Commands are:

RX = read and transmit current scale reading
S0 = Poll mode - use RX to read scale
S1 = Scale is read at normal speed (300mS) and transmitted automatically
S2 = Scale is switched to fast mode (20mS) and transmitted automatically
ZX = Zeros the scale display
V0 = sets PIC ready to read 24 bit binary devices
V1 = sets PIC ready to read 7 digit BCD devices

Output formats:

The firmware converts the various formats depending on the scale type:

Data from binary scales is transmitted as a Visual Basic compatible hex string
e.g &H000000X

Data from the 7 digit BCD types is transmitted as a decimal string
e.g. +00.0000X (inch) or +000.00mX (mm)

The trailing X is used to identify the axis in use from a multi-axis reader (not shown here).

No comments:

Post a Comment