Hello,
My title has been resolved about a year ago. Now I am coming back to this project and I can not get any communication out of the omron encoder counter.
Not sure what i can do from here.
Are there common issues that should be checked?
My code is the following(Exactly the same as the way it was working)
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial3.begin(9600,SERIAL_8E2);
}
void loop() {
// put your main code here, to run repeatedly:
while(!Serial3.available()){//wait for data in serial
Serial3.write(0x02);//STX 02H
Serial3.write("00000080177");
Serial3.write(0x03);//ETX 03H
Serial3.write(0x3A);//BCC calculated between and INCLUDING Node ID and INCLUDING ETX.
delay(50);
Serial.print("waiting");
}
while(Serial3.available()){
Serial.println(Serial3.read());//print out data in serial, I don't receive anything.
delay(50);
}
}
The grounds are all connected to each other.
SD(Send data) -> RS232 board Rx
RD(Read data) ->RS232 board Tx
SG(Signal ground) ->RS232 GND, Counter COM, Arduino GND
Can anyone find something wrong? Is it possible the RS232 level converter board(MAX232) is fried?
Thank you,
Please let me know any additional information I can provide.
Please post a link to your previous topic.
Please posta link to the Compoway/F Omron Counter.
Please post a link to the serial frame protocol.
Did you change anything since about a year ago? Code? Wiring?
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project.
The units fail to communicate through Rx3 and Tx3 as well. The code was an example, and the pins were listed because I was trying many different things to get it working.
Link to topic:
That link contains technical documents as well as serial frame protocol.
I haven't changed the code. The wiring may have changed because of relocation and disassembly etc. But I don't recall the wiring being complicated. Using the same RS232 to TTL converter. Same arduino mega. Same Omega encoder counter with same communication board. I don't have a good idea of what could be causing this issue. I know arduino Serial 3 is working. If I short Rx3 and Tx3 I get values.
Today I will check if the RS232 to TTL converter is the issue. I have gone through 3 communication boards on the omega encoder counter, so I would like to rule out hardware malfunction on that side.
This brings me to wiring, communication protocol, and communication setting as potential culprits for me.
Does this sound about right?
PS. I am very very frustrated and stressed because of a deadline. Sorry for the hurry.
try a simple loopback test to check the Mega and RS232 shield - program
// Arduino Mega serial2 test
// mega pin 16 is Tx
// pin 17 is Rx
// for loopback test connect pin 16 to pin 17
// for RS232 shield connect pin 16 to Tx and pin 17 to Rx
// for loopback test connect 9 pin D connector pins 2 and 3
unsigned long time;
void setup() {
Serial.begin(115200); // initialise serial monitor port
Serial2.begin(115200); // initialise Serial2
Serial.write("Arduino Mega Serial2 test - for loopback test connect pin 18 to pin 19\n");
}
void loop() {
if (Serial2.available()) // read from Serial1 output to Serial
Serial.write(Serial2.read());
if (Serial.available()) { // read from Serial outut to Serial1
int inByte = Serial.read();
Serial.write(inByte); // local echo if required
Serial2.write(inByte);
}
}
connect pins 2 and 3 of the 9 pin Dtype RS232 connector to form a loopback test
characters entered into the serial monitor should appear on the display