Hello all,
Thank you so much for your responses, all very helpful.
I can only apologize for all the mistakes I had made in forum etiquette but thank you for sticking with me.
cattledog:
Can you please provide a reference to the display documentation so what we can see the communication format requirements.
There isn't a lot of documentation on this, they seem to of relied on their Youtube channel for explanations.
But here is the basic data sheet.
https://docs-emea.rs-online.com/webdocs/15ea/0900766b815eac63.pdf
jremington:
RS232 communications are strictly single character format. Any other requirements will be specific to the device receiving the data, which will involve a certain sequence of single characters.
Strings cause memory problems with Arduino, so use character arrays (C-strings), or simply send all the data character by character.
Yes you are right, I think I may have a better handle on this now and the processing is something that will have to be done on the other end. From what information I haven gotten from their technical support, all sent data must be formatted "Alias,string". I think their use of String has kind of thrown me a little.
I have managed to clean and split up sections of the code and get a bit of functionality. I think right now my issues are on the end of the panel pilot for now so I will try and contact them for more information. I will however include and update my code here in case anyone in the future attempts to get these devices to communicate in this way.
Thank you all for you help.
Basic receiving from the Panel Pilot and printing to serial
// Include Industrial Shields libraries
#include <RS232.h>
void setup() {
// Begin serial port
Serial.begin(9600);
// Begin RS232 port
RS232.begin(9600);
}
void loop() {
// Print received byte when available
if (RS232.available()) {
////Read RS232 port
char rx = RS232.read();
//Send print read value to the serial port
Serial.print(rx);
}
}
Sending characters from the the serial monitor to display on the panel pilot.
As it stands because RS232 is a single character format, if you send "Hello" then H,e and two l's will briefly flash and then o will remain on the screen. Something that needs to be fixed on the panel pilot end.
// Include Industrial Shields libraries
#include <RS232.h>
void setup() {
// Begin serial port
Serial.begin(115200);
// Begin RS232 port
RS232.begin(115200);
}
void loop() {
// Wait bytes in the serial port
if (Serial.available()) {
char tx = Serial.read();
//in1 is the alias for the panel pilot receive data
String phrase = "in1,";
phrase = String(phrase + tx);
// Echo the byte to the serial port again
Serial.write(tx);
// And send it to the RS-232 port
RS232.println(phrase);
}
}