arduino duemilanove w/Atmega 328 to rs232 connecti

Hi All

I am trying to read data from a balance/scales throught a Max232 converter that is connected to a arduino duemilanove w/Atmega 328 board to pin 2rx and 3tx then connected to my computer with USB cable.
I’m trying the following code but do not get any data from the balance.

#include <SoftwareSerial.h>

//rx and tx pins for software serial - connect to laptop
int rx_pin = 2;
int tx_pin = 3;

int reading;
int baudrate = 9600;

int startbyte;
int userInput[3];
int byte_1;
int byte_2;
int i;
int smoke_toggle = LOW;
int led_toggle = LOW;
int status = LOW;
SoftwareSerial softSerial = SoftwareSerial(rx_pin, tx_pin);

void setup()
// Connections to balance
// default is 8N1. Need to change to 7N1
// change to 7 data bits
UCSR0C =UCSR0C | B00000100;


void loop()
reading =;
char c =;

I am trying to read data from the balance evry second.
Can someone please advise?

Serial.begin(baudrate); // default is 8N1. Need to change to 7N1 // change to 7 data bits UCSR0C =UCSR0C | B00000100;

Serial.begin() and direct manipulation of the USART registers only affect the [u]hardware[/u] serial port.

Check the SoftwareSerial documentation for info on setting baud rate, word size, parity, etc.


Also, you mentioned connecting to your computer through a USB cable. The max232 is not a serial to USB converter. Did you really mean a USB cable?

The way I read it, he's using the arduino's USB/rs232 interface to talk to the computer, and software serial and a MAX232 to talk to the scales.


Ah, okay, that makes more sense.

Unless the reference for SoftwareSerial is not current (entirely possible), begin() only allows you to set the baud rate. Since the scale needs 7N1, that poses a real problem. Switching the roles of the hardware and software serials might not be possible unless the pc has a serial port as well as USB.

Hmm, I thought I'd seen support for 7N1 in softwareserial, but when I peruse the latest source I don't see it. Maybe I was reading a feature request or something...

EmilyJane is correct, you may need to move some things around so that you talk to the scale via the hardware UART and talk to the PC using softwareserial.

Unless there is a way you can make the scale speak 8N1?