I'm having some difficulty getting the RX and TX ports to communicate with a Canon PTZ camera. I'm trying to send RS232 commands via pins 0 and 1 on an Arduino Mega2560 to a Canon VC-C50iR. I normally program Crestron and AMX systems, but I have a special project that spec'd this Arduino board as the main controller. Here is a sample command to the Canon:
($ = hex character)
$FF,$30,$30,$00,$60,$30,$31,$EF
This is an 8 byte string for the "tilt up" command. Here is a sample of the code used to send the string:
Serial.write(255);
Serial.write(48);
Serial.write(48);
Serial.write(0);
Serial.write(96);
Serial.write(48);
Serial.write(49);
Serial.write(239);
I have confirmed through the Serial Monitor while plugged in via USB that the correct commands are being sent. However, the camera was not responding, so I connected my Arduino board to my PC's serial port and opened a console program to read the commands. Instead of the expected string ($FF,$30,$30,$00,$60,$30,$31,$EF), I received this string:
$00,$F6,$F6,$3F,$9F,$9D,$21
I'm not sure why the Serial Monitor says one string, while the actual TX output is another. In fact, it's not even the same number of bytes. Am I missing a setup step for the RS232 interface to work correctly? Is there additional hardware necessary? The only command I can find relating to RS232 setup is "Serial.begin(9600);" in the setup section which is already present in my program. I have also tried using the additional serial ports (changed Serial.write to Serial1.write, Serial2.write, & Serial3.write). Any help would be appreciated.