Generally, the control protocols are compiled by hardware or software vendors in the program. We only need to perform operations through the related control devices. However, as a technician in the monitoring industry, there is often no control equipment except for computers and Protocol converters. At this time, the original protocol code becomes a life-saving straw.
PELCO-D:
Data format: 1-bit start bit, 8-bit data, 1-bit stop bit, invalid verification bit. Baud Rate: 2400b/s
Command Format:
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Synchronization bytes
Address Code
Script 1
Script 2
Data Code 1
Data Code 2
Verification Code
1. All values in this Protocol are hexadecimal.
2. The Synchronization Byte is always FFH
3. The address code is the camera's logical address number. The address range is 00h-ffh.
4. The script code indicates different actions.
5. Data codes 1 and 2 indicate the horizontal and vertical speed (00-3fh), and FFH indicate the "Turbo" speed.
6. Verification code = mod [(byte 2 + byte 3 + byte 4 + byte 5 + byte 6)/100 H]
Take the address code 0x01 as an example:
{0xff, 0x01,0x00,0x08,0x00, 0xff, 0x08 ,} //
{0xff, 0x01,0x00,0x10,0x00, 0xff, 0x10 ,} //
{0xff, 0x01,0x00,0x04, 0xff, 0x00,0x04,} // left
{0xff, 0x01,0x00,0x02, 0xff, 0x00,0x02,} // right
{0xff, 0 x, 0x20, 0 x, 0 x, 0x21,} // shorten
{0xff, 0 x, 0x40, 0 x, 0 x, 0x41,} // change the length
{0xff, 0 x, 0x80, 0 x, 0 x, 0x81,} // focus near
{0xff, 0x01,0x01,0x00,0x00,0x00,0x02,} // focus far
{0xff, 0x01,0x02,0x00,0x00,0x00,0x03,} // Small Aperture
{0xff, 0x01,0x04,0x00,0x00,0x00,0x05,} // Large Aperture
{0xff, 0x01,0x00, 0x0b, 0x00,0x01, 0x0d,} // light off
{0xff, 0x01,0x00,0x09,0x00,0x01, 0x0b,} // light on
{0xff, 0x01,0x00,0x07,0x00,0x01,0x09,} // go to the preset point 001
{0xff, 0x01,0x00,0x03,0x00,0x01,0x05,} // set the preset point 001
{0xff, 0 x, 0 x, 0 x, 0 x, 0x07,} // Delete preset point 001
The preceding commands are as follows:
{0xff, 0x01,0 X, 0 x, 0 x, 0 x,} // stop the command
PELCO-P:
Data format: 1-bit start bit, 8-bit data, 1-bit stop bit, invalid verification bit. Baud Rate: 9600b/s
Command Format:
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
8 bytes
STX
Address Code
Script 1
Script 2
Data Code 1
Data Code 2
Etx
Verification Code
1. All values in this Protocol are hexadecimal.
2. STX is always a0h
3. The address code is the camera's logical address number. The address range is 00h-1fh.
4. The script code indicates different actions.
5. Data codes 1 and 2 indicate horizontal and vertical speeds (00-3fh) respectively. During operations on pre-made points, data codes 2 indicate pre-made point values.
6. etx is always AFH
7. Check Code (XOR sum of Bytes 2-6) = byte 2 ^ byte 3 ^ byte 4 ^ byte 5 ^ byte 6
Take the address code 0x01 as an example:
{0xa0, 0x01,0x00,0x08,0x00,0x30, 0xaf, 0x39 ,}//
{0xa0, 0x01,0 x, 0x10, 0 x, 0x30, 0xaf, 0x21 ,} //
{0xa0, 0x01,0 x, 0x10, 0x00, 0xaf, 0x15,} // left
{0xa0, 0x01,0x00,0x02,0x10, 0x00, 0xaf, 0x13,} // right
{0xa0, 0x01,0 x, 0x40, 0 x, 0x00, 0xaf, 0x41,} // shorten
{0xa0, 0x01,0 x, 0x20, 0 x, 0x00, 0xaf, 0x21,} // change the length.
{0xa0, 0x01,0x02,0x00,0x00,0x00, 0xaf, 0x03,} // focus near
{0xa0, 0x01,0x01,0x00,0x00,0x00, 0xaf, 0x00,} // focus far
{0xa0, 0x01,0x08,0x00,0x00,0x00, 0xaf, 0x09,} // Small Aperture
{0xa0, 0x01,0x04,0x00,0x00,0x00, 0xaf, 0x05,} // Large Aperture
No command to send // light off
No command to send // light on
{0xa0, 0x01,0 x, 0 x, 0 x, 0x20, 0xaf, 0xb7,} // automatic cruise
{0xa0, 0x01,0 x, 0x99,0 x, 0x20, 0xaf, 0xb8,} // turn off automatic cruise
{0xa0, 0x, 01,0x00,0x07,0x00,0x01, 0xaf, 0x07,} // go to the preset point 001
{0xa0, 0x01,0x00,0x03,0x00,0x01, 0xaf, 0x03,} // set the preset point 001
{0xa0, 0x01,0 x, 0 x, 0x01, 0xaf, 0x01,} // Delete preset point 001
The following commands are used to stop the system ):
{0xa0, 0x01,0x00,0x00,0x00,0x00, 0xaf, 0x01 ,}
***********************************
Note: The default address code pelco-d is 1 pelco-p. The default value is 0.
[Url = http://www.af.shejis.com/new_#/html/7341.shtml#/url]
Test procedure for PELCO-D Cloud Platform
**************************************** ************
Parsing and downloading the PELCO Protocol
Shen xueyu
In the development of IBMS interfaces, we need to use some common protocols, while PELCO (PELCO) monitoring equipment is widely used in China. PELCO has its own transmission control protocol, which can be compatible with each other when its products are used together. However, in some cases, due to engineering needs, it is required to use other devices (such as computers) to control the matrix or lens of PELCO, which requires a full understanding of the PELCO transmission protocol.
PELCO commonly used two Protocols: PELCO-D protocol and PELCO-P protocol.
-PELCO-D protocol Parsing
PELCO-D protocols are generally used for communication between matrices and other devices. The format is as follows:
Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 synchronous word address code command word 1 command word 2 data 1 Data 2 Verification Code
All values are represented in hexadecimal notation.
The synced word is usually $ FF.
The address code refers to the logical address of the device that communicates with the matrix. It can be set in the device.
Command word 1 and command word 2 are set as follows:
Bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0 command word 1SENCE code00Automatic/manual ScanningCamera on/offAperture disabledOpen apertureZoom inCommand 2Focal LengthWidening AngleNarrow Angle of ViewUpperLowerLeftRight0
The Sence code is related to bit4 and bit3. When bit4 and bit3 are 1, if sence code is 1, the command is to automatically scan and enable the camera. If sence code is 0, the command is to manually scan and the camera is disabled. Of course, if bit4 or bit3 is 0, the command will be invalid.
Data 1 indicates the moving speed between the left and right of the lens. The value ranges from $00 (STOP) to $ 3f (high speed). Another value is $ ff, which indicates the highest speed.
Data 2 indicates the speed at which the lens moves up and down. The value ranges from $00 (STOP) to $ 3f (maximum speed ).
A verification code refers to the sum of the five numbers from byte2 to byte6 (if it exceeds 255, it is divided by 256 and then the remainder is obtained ).
-PELCO-P protocol Parsing
PELCO-P Protocol generally uses RS-485 transmission, baud rate is, 1 bit start bit and stop bit, 8 bit data bit, no verification. The format is as follows:
ByteValueFunction1$ A0Start code2$00 to $ 1FAddress Code3Data byte 1Data bit 14Data byte 2Data bit 25Data byte 3Data bit 36Data byte 4Data bit 47$ AFStop code8$00-$ FFVerification Code
The start code is a fixed value $ A0.
The address code is the logical address of the device. It can be set by the DIP switch on the receiving device.
The meaning of Data bit 1 to 4 is as follows:
Bit number76543210Data bit 10Camera openAutomatic ScanningCamera on/offAperture disabledOpen apertureZoom inFocal LengthData bit 20Widening AngleNarrow Angle of ViewLowerUpperLeftRight0Data bit 3 Translation speed $00 (STOP) to $ 3f (high speed) and $40 (maximum speed)Data bit 4 Up/down speed $00 (stopped) to $ 3f (highest speed)
The stop code is a fixed value $ AF.
The verification code is the exclusive or value (XOR) of the five numbers from Byte2 to Byte6 ).
The address code starts from 0, so the address code $00 indicates the first device.
PELCO-D and PELCO-P protocols also have some special commands that can be used for advanced control of the device, but these applications are not common, limited by space, here is not much to mention.