Just for sake of curiosity, what happens if you directly connect Serial1 to Serial2/Serial3 on a Mega 2560? I thought since they all work with TTL signals, no level converter is needed for them to talk to one another, right? But when I tested this theory on the actual hardware, it looks like the receiving serial port will always receive a char that has an extended-ascii value of 152, no matter what you sent to it.
Interesting...
I'm eager to hear any idea or explanation from all of you
BTW, I did make sure that the TX pin of one port is connected to the RX pin of another port.
SurferTim:
Easy. Go to the bathroom and look in the mirror. Talk to your heart's content. What good does it do? Your family will think you have lost your mind.
"...it will work, but you will only hear yourself talk."
Actually, the problem is that it will NOT work (didn't work for me at least), all I got was a meaningless char. My point is, if Serial1-3 all talk in TTL, why wiring them up directly won't work? What's missing here?
void setup() {
// initialize serial:
Serial.begin(9600); // For monitoring on PC
Serial1.begin(9600); // Sender
Serial3.begin(9600); // Receiver
}
void loop() {
Serial1.println("Doesn't matter what you say here."); // Send from Serial1 to Serial3, so wire them up accordingly, directly, without anything like a MAX232
delay(2000);
if (Serial3.available()) {
// get the new byte:
char inChar = (char)Serial1.read();
Serial.println(inChar); // Send to PC what Serial3 received
}
}
To simplify the situation, I just sent Serial1.println('A'); during testing
This is the exact code that was producing the funny y on my board (and it still is):
void setup() {
// initialize serial:
Serial.begin(9600); // For monitoring on PC
Serial1.begin(9600); // Sender
Serial3.begin(9600); // Receiver
}
void loop() {
Serial1.print('A'); // Send from Serial1 to Serial3, so wire them up accordingly, directly, without anything like a MAX232
delay(2000);
if (Serial3.available()) {
// get the new byte:
char inChar = (char)Serial1.read();
Serial.println(inChar); // Send to PC what Serial3 received
}
}
I've even power off/reset the board several times by now.