HardwareSerial and SoftSerialPort

Hy

Currently I'm working on reading data from a device before they get to the transmitter.
Final goal is to read the data, as soon as a pause is detected send some additional data
to the transmitter.

Currently I like to use the SoftSerail port 2 and 3 to receive and send the data out.
This does not work. I use the code below:

  while(c3.available() > 0){
    byte tempit = c3.read();
    c3.write(tempit);
  }

However when I use the Hardware Serial Port it does work:

 while(Serial.available() > 0){
    byte tempit = Serial.read();
    Serialwrite(tempit);
  }

even when I read the data from the SoftSerial Port and send it through the Hardware port this works as well;

  while(c3.available() > 0){
    byte tempit = c3.read();
    Serial.write(tempit);
  }

Can someone help me to get this working an the tx SoftSerialPort

Andy

SoftwareSerial cannot transmit and receive at the same time - you must choose one or the other.

I wonder if a slight delay between reading and writing would help - though it might not suit the logic of what you want to do.

...R

Serialwrite(tempit);

Did anybody notice the missing FULL STOP in the "Serial.write(tempit); statement ?

raschemmel:
DID ANYBODY NOTICE THE MISSING DECIMAL POINT IN THE "Serial.write(tempit); statement ?

Surely it is a missingfull stop

...R

Or change your micro to another capable of 2 hardware serial ports, some AVR examples (from cheaper to more expensive):

ATmega164A
ATmega164PA
ATmega324A
ATmega324PA
ATmega644A
ATmega644PA
ATmega1284
ATmega1284P

Surely it is a missing full stop

whatever....

thx for all the comments.
Sorry it was a mistype otherwise it wouldn't compile :slight_smile:

Hmm so I have to look for another micro... Hope there are PCB as small as the Arduino Pro Mini 328...

Andy

raschemmel:

Surely it is a missing full stop

whatever....

Lighten up - it was meant as a joke.

...R

Ok. got it.

:slight_smile: