I am trying to read the output from a Veritas 123 digital balance, the output I want to read is the stream that it sends to a serial printer. The output from the balance is a DB-9 connector in RS232 format. I take Pin #2 (the transmit pin) of the DB 9 from the balance and put it on pin 13 (R1IN) of the MAX232 IC and take pin 12 (R1OUT) on the MAX 232 and connect it to pin 2 on my UNO and use SoftwareSerial to set pin 2 for receive and 3 for TX without input on 3. I have the rest of the MAX232 set up as it says in the datasheet. I am not concerned with sending the balance any commands so I have not taken the TX from UNO to the RX on the balance.
When I command the balance to print out its current reading I get the following:
32
32
32
32
32
48
46
48
48
32
71
78
32
13
10
And if I put 5.31 grains on the scale I get a different string here it is I have taken the LF/CR out so it does not take so much screen to read
32 32 32 32 32 53 46 50 57 32 71 78 32 13 10
The number of characters seems to be correct as the very sparse manual says there are 15 characters when in the weight mode. Here is the definition of what the format in this mode is supposed to be:
Transmission format
String transmitted is composed by the following 14 characters:
First character: weight sign (blank or -)
second/ninth character: weight or other data
tenth/twelfth character: weight unit symbol
thirteenth character: stability indicator
fourteenth character: carriage return
fifteenth character: line feed
Eventually non-significative zero are spaces.
Here is the code that I am using to test the setup.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // pin 2 for receive 3 for tx
void setup()
{
Serial.begin(9600); // Serial Monitor
// set the data rate for the SoftwareSerial port The scale
mySerial.begin(4800);
}
void loop()
{
if (mySerial.available())
{
Serial.println(mySerial.read());
}
}
The balance only sends data out when I tell it to print and both the systems use a 4800 baud rate so I do not think this is noise or gibberish I just don't seem to have it in the correct format.
Does anyone out there have any hints for converting this?
Thanks
wade