Shop OBEX P1 Docs P2 Docs Learn Events
PC interface on the Radio Shack 220-0812 Digital Multimeter — Parallax Forums

PC interface on the Radio Shack 220-0812 Digital Multimeter

tdlivingstdlivings Posts: 437
edited 2012-01-03 11:23 in Propeller 1
I have been playing around with the PC interface on the Radio Shack 220-0812 Digital Multimeter and wanted to post to share some results and info for anyone else who has one of these meters.
Since Parallax is now selling the Quick Start board at Radio Shack I look at it as a possible demo using another Radio Shack product, in the spirit of the Kick Start demos.
The first cut is just a build a kludge and learn from it type of program. I am a big believer in short programs that are not elegant but are just code put together to see what it does and to test algorithms.

I originally had wires going over to a breadboard but converted to using the Gadget Gangster QuickStart Adapter and Protoplus which gave me a place to build the RS-232 interface and the video out connection. I have not used the video before and that was part of my experimenting and I thought it would be good to show off a feature of the propeller chip.

I attached the doc file describing the meter interface, which I found at this link
http://support.radioshack.com/support_meters/doc68/68424.pdf


The first thing you need is to interface the +/- 25 volt RS-232 levels into 3.3 volt logic levels.
Actually the spec for Rs_232 goes to 25 volts but the meter only does +/- 5.
I used the Max3232 chip, which is the same one Parallax uses on there development board.


This version is a simple polling of the serial data using FullDuplex.spin
I tried Simple Serial at first but without the 16 byte buffer FullDuplex has
all I got was bad checksums and Simple Serial did not keep up and missed bytes
of the RS meter message.
To determine if we have a good complete message from the meter I have a simple state
machine based on which byte of a message we think we are receiving.
The RS Meter sends a 9 byte message with the first byte being Meter Mode.
So watch for a received byte that is between 0 and 25 and assume that is the start of
a message and save the byte and add it to the check sum.
For the next 7 bytes just save the byte and add it to the check sum.
The 9th byte received should be the checksum .
The RS doc for the meter indicates 0x57 in the formula for computing the checksum
but it is actuall 57 decimal.

If we have a our computed check sum matches the 9th byte count it as good and
parse the data in the message and display it.
[FONT=Parallax]repeat[/FONT]
[FONT=Parallax]rxbyte := Serial.Rx[/FONT]
[FONT=Parallax]Case bytecnt[/FONT]
[FONT=Parallax] 0:[/FONT]
[FONT=Parallax]   if rxbyte =< 25[/FONT]
[FONT=Parallax]     msgbuf[bytecnt] := rxbyte[/FONT]
[FONT=Parallax]     chksum := chksum + rxbyte[/FONT]
[FONT=Parallax]     bytecnt++[/FONT]
[FONT=Parallax] 1..7:[/FONT]
[FONT=Parallax]   msgbuf[bytecnt] := rxbyte[/FONT]
[FONT=Parallax]   chksum := chksum + rxbyte[/FONT]
[FONT=Parallax]   bytecnt++[/FONT]
[FONT=Parallax] 8:[/FONT]
[FONT=Parallax]   msgbuf[bytecnt] := rxbyte[/FONT]
[FONT=Parallax]   chksum := (chksum + 57) & 255      'Note chksum had to be word size and then trimed to a byte[/FONT]
[FONT=Parallax]   if (chksum == msgbuf[bytecnt])[/FONT]
[FONT=Parallax]     goodcount++[/FONT]
[FONT=Parallax]     TVGoXY(0,4)[/FONT]
[FONT=Parallax]     TVTX.str(String("Good "))[/FONT]
[FONT=Parallax]     TVGoXY(7,4)[/FONT]
[FONT=Parallax]     TVTX.Dec(goodcount)[/FONT]
[FONT=Parallax]     TVGoXY(1,5)[/FONT]
[FONT=Parallax]     Repeat 20[/FONT]
[FONT=Parallax]       TVTX.out($20)[/FONT]
[FONT=Parallax]     GetDigits(@msgbuf)               'Parse the message into a string to display[/FONT]
[FONT=Parallax]     TVGoXY(0,5)[/FONT]
[FONT=Parallax]     TVTX.str(@DisplayVal)            'A string of digits like the meter display[/FONT]
[FONT=Parallax]     TVTX.out($20)[/FONT]
[FONT=Parallax]     TVTX.str(@DisplayUnits)          'A string for measurement units and scaling[/FONT]
[FONT=Parallax]     TVPrtMode(0,3)                   'A string for what mode the meter is in[/FONT]
[FONT=Parallax]     TVPrtValue(0,6)                  'A string like a floating point string ex 2.345e-6[/FONT]
[FONT=Parallax]   else[/FONT]
[FONT=Parallax]     badcount++[/FONT]
[FONT=Parallax]     outa[RS_DTR] := 1       'Shut down the RS Meter clear the rec buffer and restart[/FONT]
[FONT=Parallax]     waitcnt(clkfreq +cnt)[/FONT]
[FONT=Parallax]     Serial.rxflush[/FONT]
[FONT=Parallax]     waitcnt(clkfreq/100 + cnt)[/FONT]
[FONT=Parallax]     outa[RS_DTR] := 0       'Start up again[/FONT]
[FONT=Parallax]      TVGoXY(20,4)[/FONT]
[FONT=Parallax]      TVTX.str(String("BAD "))[/FONT]
[FONT=Parallax]      TVGoXY(25,4)[/FONT]
[FONT=Parallax]      Repeat 10[/FONT]
[FONT=Parallax]        TVTX.out($20)[/FONT]
[FONT=Parallax]      TVGoXY(25,4)[/FONT]
[FONT=Parallax]      TVTX.Dec(badcount)[/FONT]
[FONT=Parallax]   {Set up for the next message}[/FONT]
[FONT=Parallax]   chksum := 0[/FONT]
[FONT=Parallax]   bytecnt := 0[/FONT]

Future experiment(Demos) are to try different displays and use XBEE modules to transmit the meter value as a remote data logger. Also log values to an SD card.
I attached a pic of the RS-232 interface and the spin program and some pics of the hardware.
The pic I tried to take of the video screen did not come out to good but does show it working.

With the code as shown I only get a bad checksum when you turn the meters rotary switch from off to any measurement selection
and even before enabling the RS-232 interface on the meter. The meter seems to wiggle the interface for some reason on turn on.
I have had it sitting and logging messages to the screen with counts of 24,000 good messages.

Tom
341 x 454 - 47K
640 x 360 - 228K
640 x 360 - 250K
640 x 360 - 212K

Comments

Sign In or Register to comment.