PELCO-D/PELCO-P协议
PELCO-D:
数据格式:1位起始位、8位数据、1位停止位,无效验位。波特率:2400B/S
命令格式:
字节1 |
字节2 |
字节3 |
字节4 |
字节5 |
字节6 |
字节7 |
同步字节 |
地址码 |
指令码1 |
指令码2 |
数据码1 |
数据码2 |
校验码 |
1. 该协议中所有数值都为十六进制数
2. 同步字节始终为FFH
3. 地址码为摄像机的逻辑地址号,地址范围:00H–FFH
4. 指令码表示不同的动作
5. 数据码1、2分别表示水平、垂直方向速度(00-3FH),FFH表示“turbo”速度
6. 校验码 = MOD[(字节2 + 字节3 + 字节4 + 字节5 + 字节6)/100H]
以地址码0x01为例:
{0xff,0x01,0x00,0x08,0x00,0xff,0x08,}//上
{0xff,0x01,0x00,0x10,0x00,0xff,0x10,}//下
{0xff,0x01,0x00,0x04,0xff,0x00,0x04,}//左
{0xff,0x01,0x00,0x02,0xff,0x00,0x02,}//右
{0xff,0x01,0x00,0x20,0x00,0x00,0x21,}//变倍短
{0xff,0x01,0x00,0x40,0x00,0x00,0x41,}//变倍长
{0xff,0x01,0x00,0x80,0x00,0x00,0x81,}//聚焦近
{0xff,0x01,0x01,0x00,0x00,0x00,0x02,}//聚焦远
{0xff,0x01,0x02,0x00,0x00,0x00,0x03,}//光圈小
{0xff,0x01,0x04,0x00,0x00,0x00,0x05,}//光圈大
{0xff,0x01,0x00,0x0b,0x00,0x01,0x0d,}//灯光关
{0xff,0x01,0x00,0x09,0x00,0x01,0x0b,}//灯光开
{0xff,0x01,0x00,0x07,0x00,0x01,0x09,}//转至预置点001
{0xff,0x01,0x00,0x03,0x00,0x01,0x05,}//设置预置点001
{0xff,0x01,0x00,0x05,0x00,0x01,0x07,}//删除预置点001
以上对应的停命令均是:
{0xff,0x01,0x00,0x00,0x00,0x00,0x01,}//停命令
PELCO-P:
数据格式:1位起始位、8位数据、1位停止位,无效验位。波特率:9600B/S
命令格式:
字节1 |
字节2 |
字节3 |
字节4 |
字节5 |
字节6 |
字节7 |
字节8 |
STX |
地址码 |
指令码1 |
指令码2 |
数据码1 |
数据码2 |
ETX |
校验码 |
1. 该协议中所有数值都为十六进制数
2. STX始终为A0H
3. 地址码为摄像机的逻辑地址号,地址范围:00H–1FH
4. 指令码表示不同的动作
5. 数据码1、2分别表示水平、垂直方向速度(00-3FH),在有关预制点的操作时,数据码2表示预制点值
6. ETX始终为AFH
7. 校验码(XOR sum of Bytes 2-6) = 字节2 ^ 字节3 ^ 字节4 ^ 字节5 ^ 字节6
以地址码0x01为例:
{0xa0,0x01,0x00,0x08,0x00,0x30,0xaf,0x39,}//上
{0xa0,0x01,0x00,0x10,0x00,0x30,0xaf,0x21,}//下
{0xa0,0x01,0x00,0x04,0x10,0x00,0xaf,0x15,}//左
{0xa0,0x01,0x00,0x02,0x10,0x00,0xaf,0x13,}//右
{0xa0,0x01,0x00,0x40,0x00,0x00,0xaf,0x41,}//变倍短
{0xa0,0x01,0x00,0x20,0x00,0x00,0xaf,0x21,}//变倍长
{0xa0,0x01,0x02,0x00,0x00,0x00,0xaf,0x03,}//聚焦近
{0xa0,0x01,0x01,0x00,0x00,0x00,0xaf,0x00,}//聚焦远
{0xa0,0x01,0x08,0x00,0x00,0x00,0xaf,0x09,}//光圈小
{0xa0,0x01,0x04,0x00,0x00,0x00,0xaf,0x05,}//光圈大
无命令字发送//灯光关
无命令字发送//灯光开
{0xa0,0x01,0x00,0x96,0x00,0x20,0xaf,0xb7,}//自动巡航
{0xa0,0x01,0x00,0x99,0x00,0x20,0xaf,0xb8,}//关闭自动巡航
{0xa0,0x01,0x00,0x07,0x00,0x01,0xaf,0x07,}//转至预置点001
{0xa0,0x01,0x00,0x03,0x00,0x01,0xaf,0x03,}//设置预置点001
{0xa0,0x01,0x00,0x05,0x00,0x01,0xaf,0x01,}//删除预置点001
以上对应的停命令均是(上下左右、变倍、聚焦、光圈均有停命令):
{0xa0,0x01,0x00,0x00,0x00,0x00,0xaf,0x01,} |