Pages: [1]   Go Down
Author Topic: Issue using Arduino UNO as a bridge  (Read 989 times)
0 Members and 1 Guest are viewing this topic.
Texas, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Arduino gang.
My first post here. I am trying to use my Arduino UNO as a bridge between two communication ports (COM11 and COM3) in my laptop.
So far, I can send a byte from the Arduino serial monitor (COM11) to the USB Arduino connector and read it as echo in in the Arduino serial monitor, and, I am receiving in the other port (COM3) monitored with hyper-terminal the "same byte" from from the Pin0 (RX), pin1 (TX) and pin GND) of the Arduino board. Here the issue:
If for example, I press the key 1 and hit send in the Arduino serial monitor, I received 49 (DEC) as echo in the Arduino serial monitor and also I receive 67 (HEX) in my hyper-terminal. For 2, I get 50 (DEC) and 33 (HEX), for F, I receive 70 (DEC) and 2E (HEX), etc.
After a brief research, I don't see any relationship between what I get in both terminals. What I need is to read the same or equivalent data in both ports. Am I doing something wrong?

Here my code:

Code:
byte rx_byte;

void setup() {
  Serial.begin(115200);
}

void loop() {
  if (Serial.available() > 0) {
    rx_byte = Serial.read();
    Serial.print(rx_byte);
  }
}

 Thank you.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you want Serial.write(rx_byte); instead of Serial.print(rx_byte);
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Texas, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you John. I tried your suggested change but the problem continues. Regards.
Logged

Chile
Offline Offline
Edison Member
*
Karma: 35
Posts: 1251
Arduino rocks?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Check it again, it should work with write. Test first the script directly with your pc and one board.
Logged

My website: http://ried.cl

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am receiving in the other port (COM3) monitored with hyper-terminal the "same byte" from from the Pin0 (RX), pin1 (TX) and pin GND) of the Arduino board. Here the issue:
How are these three pins connected to the PC?
Logged

Texas, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks eried and Paul for answers. I want to clarify that I do not have problems sending/receiving data between the Arduino USB port and the laptop USB port (COM11).
If you re-read my first post here: The equivalent for ASCII char 1 is 49 DEC, ASC char F is 70 DEC, etc. My problem is when I try to read the same data from the Pins 0,1,14 of the Arduino board in another port of my laptop.
Let me explain you a bit better what I am pursuing here. I am planning to connect a device 1 and exchange data via USB Com with the Arduino. Then, taking advantage of the trigonometrical functions of the Arduino, do some calculations and finally send the results to a device 2 connected to the pins 0,1,14. In other words, to use the UNO as a bridge. Of course, the two devices tied to Arduino are enough intelligent.
Paul. I am far from my lab but I am pretty sure the three pins are connected to the laptop as follows (Crossover):

http://img402.imageshack.us/img402/6427/issue1.jpg

I've been working with microcontrollers like MSC-51 family since 1991 but this Arduino is new for me. Thank you.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My problem is when I try to read the same data from the Pins 0,1,14 of the Arduino board in another port of my laptop.

The Arduino outputs TTL level signals. Your PC is expecting RS232 levels. You haven't said whether you are using a RS232 to TTL converter, so, you may be getting garbage input.

What is pin 14 doing? It has nothing to do with communication? Is there a ground connection that you failed to mention?
« Last Edit: September 04, 2012, 09:46:50 am by PaulS » Logged

Texas, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am not using a converter. As you mentioned, that should be the reason of a consistent biunivocal garbage input. I will check that. Pin 14 is GND. I am not using the real UNO but the Arduino compatible OSEPP UNO R3 Plus module. So far for me, it behaves like the Arduino UNO. Thanks.   
Logged

Pages: [1]   Go Up
Jump to: