system
December 19, 2014, 10:04pm
1
right i have a pelco camera and a vcl keyboard.
pelco address 01 vcl address one 80 and so on
i have the hex understood for each device.
so i want to be able to press a button on the vcl keyboard, that hex string goes in to the arduino gets sorted ie 81 that's address 2 so ff 02 and so on with the commands ect, then calculate the check sum then sends that out to the camera
i have seen straight rs425 to rs485 but nothing with a kinda lookup table in the middle.
theirs loads of pdf of the pelco d code on Google but if you want the vcl code its impossible to find but its 3 bits address commend speed
any help will be appreciated.
system
December 26, 2014, 1:50am
2
right
void setup()
{
Serial.begin(9600); // setup serial for VCl
Serial3.begin(9600); // setup serial for Pelo
}
void loop()
{
if (Serial.available() > 0){
Serial3.write((int)SynchByte); // Synch Byte
int CameraAddress = Serial.read();
if (CameraAddress = 0x80)
{ // address tie 1
Serial3.write(CameraAddress = 0x01);
}
if (CameraAddress = 0x81)
{ // address tie 2
Serial3.write(CameraAddress = 0x02);
}
Serial3.write((byte)command1);
Serial3.write((byte)command2);
Serial3.write((byte)PanSpeed); //Pan Speed
Serial3.write((byte)TiltSpeed); //Tilt Speed
byte checkSum = ((byte)CameraAddress + (byte)command1 + (byte)command2 + (byte)PanSpeed + (byte)TiltSpeed)%256;
Serial3.write((byte)checkSum); //check sum is the sum of bytes (excluding the synchronization byte) modulo 256
}
delay(100);
}
returns
26/12/2014 01:40:11.846 [TX] - 80
26/12/2014 01:40:11.870 [RX] - FF 01 02 00 00 00 00 02
26/12/2014 01:40:13.768 [TX] - 81
26/12/2014 01:40:13.781 [RX] - FF 01 02 00 00 00 00 02
26/12/2014 01:40:14.595 [TX] - 82
26/12/2014 01:40:14.671 [RX] - FF 01 02 00 00 00 00 02
26/12/2014 01:40:15.830 [TX] - 83
26/12/2014 01:40:15.872 [RX] - FF 01 02 00 00 00 00 02
26/12/2014 01:40:17.454 [TX] - 84
26/12/2014 01:40:17.473 [RX] - FF 01 02 00 00 00 00 02
26/12/2014 01:40:18.236 [TX] - 85
26/12/2014 01:40:18.273 [RX] - FF 01 02 00 00 00 00 02
26/12/2014 01:40:18.861 [TX] - 86
26/12/2014 01:40:18.875 [RX] - FF 01 02 00 00 00 00 02
26/12/2014 01:40:19.658 [TX] - 87
26/12/2014 01:40:19.674 [RX] - FF 01 02 00 00 00 00 02
26/12/2014 01:40:20.346 [TX] - 87
26/12/2014 01:40:20.375 [RX] - FF 01 02 00 00 00 00 02
right so why is the camera address bring sent twice?
and why is it sending when the data is out of range?