Pages: [1]   Go Down
Author Topic: Problem with softserial on Duemilanove  (Read 383 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I have a problem reading from a barcode scanner from any other pin then the rx(0)
I am getting the required code and everything works great with the normal Rx pin. but once i use the Newsoftserial library with any other pin (tried with 2 8 and 9)i get a weird output: 45bƒD$F4T$6„þ instead of getting 451004002400035238
does anyone know what the real problem is?
is it from the library itself?
here are some more information:
I am using a max233cpp chip between the barcode and the arduino Duemilanove
all the connections seems to work fine with the rx pin of the arduino
my barcode reader has a baud rate of 9600

and here is the sample program that i am using with software serial 11 beta

#include <SoftwareSerial.h>

SoftwareSerial mySerial(9, 4);

void setup() 
{
  Serial.begin(9600);
  Serial.println("Please Work!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);

}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.print((char)mySerial.read(), BYTE);
  if (Serial.available())
    Serial.print((char)Serial.read());
}


Thanks for any help of guidance
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13477
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


you should use NewSoftSerial iso SoftSerial as it performs much better.  - http://arduiniana.org/libraries/newsoftserial/ -

INterface is the same, but under the hood things are fixed.

Also check the config of the barcodereader for # stopbits should be 1.

Does the barcode reader work on the hardware Serial?

Succes,
Rob


Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for the reply!
Indeed you have inspired me to ding into the documentation of the barcode reader, and change the way it transmits data.

for future reference use Fujitsu rs-232C standard. that will work with the newsofserial of the arduino on any pin.

Thanks again! smiley
Logged

Pages: [1]   Go Up
Jump to: