I'm working on a project where I have to communicate to a machine using RS232. I've been using an RS232 to USB adapter to work on getting the machine to work, by communicating on a serial terminal (Termite). So now the machine is completely function and I can work on it from my computer.
However, the next step is to automate some of the processes that this machine does. So I want to control it using an Arduino Uno.
So I have these pin outs of the RS232 from the manual of the machine, however this is practically all there is when connecting using RS232. So the next thing I've done is the following:
RXD -> TX (PIN 2 on RS232, to PIN 3 on Arduino)
TXD -> RX (PIN 3 on RS232, to PIN 2 on Arduino)
ground to ground (PIN 5 to ground)
One issue I'm running into is that to upload to the Arduino, I cannot be connected to the dedicated RX and TX pins (pins 0 and 1), so I've done the following. Super basic.
void setup()
{
byte rx = 2; //rx pin number
byte tx = 3; //tx pin number
pinMode(rx, INPUT);
pinMode(tx, OUTPUT);
Serial.begin(9600, SERIAL_8N1); //9600 baudrate, 8 data bit, no parity, 1 stop bit
}
void loop()
{
Serial.write("/1P200R\n"); //writes/1P200R (this is a built in command on the machine that works when connected to the machine using USB. The \n is the character return (CR)
delay(1000);
}
When I do this, I can see the ouput of /1P200R every second on the serial monitor, but my machine does nothing.
Does anyone have any suggestions on how I can get some communication with my machine through the Arduino? Should I be using pin 0 and 1, the dedicated RX and TX? I've tried this but nothing changed with the output.
