Hi, I am trying to use the arduino base PLC to connect to a display via RS232 but couldn't get it work.
I have tried to follow the DIP switches and header configs as per the manual and shorting the Tx and Rx of the RS232 port but doesn't seem to be working. I have attached photos showing the setup and the testing code below.
/*
* STEP 1 ONLY until you see "echo 25":
* - Unplug LCD completely
* - Short PLC RS232 terminals: RX <-> TX only (pins under RS232 label)
* - TOP DIP ON OFF ON OFF
* - LEFT: RE OFF, I0.4 ON, DE OFF, I0.5 ON
* - Zone 3: both shunts on RS-232 HARDWARE (not RS-485)
*/
#include <RS232.h>
void setup() {
Serial.begin(9600);
while (!Serial && millis() < 8000) {
;
}
RS232.begin(38400);
Serial.println(F("STEP1: LCD UNPLUGGED + RX-TX short"));
Serial.println(F("Waiting for echo 25 ..."));
}
void loop() {
static unsigned long t;
RS232.write((uint8_t)25);
if (RS232.available()) {
int v = RS232.read();
Serial.print(F("echo "));
Serial.println(v);
}
if (millis() - t >= 1000) {
t = millis();
Serial.println(F("ping (no echo yet, RS232 path dead)"));
}
}