When using SONY Autofocus cameras we often refer to the VISCA protocol, so what exactly is this protocol? What does it do? Today, Shenzhen Xuanzhan Technology will interpret the SONY Autofocus VISCA protocol for you.
What is the SONY Autofocus cameras VISCA protocol?
VISCA is a professional Autofocus cameras control protocol for use with PTZ cameras. It was designed by SONY and is based on RS232 at 9600 bit/s. SONY is using VISCA for CCTV cameras. Blackmagic Design’s ATEM switchers with RS-422 ports and controlled by ATEM 1M/E or ATEM 2M/E control panels can control VISCA protocol-compatible cameras.
Let’s look at the following characteristics:
1. Command format
The basic unit of command communication is called a Packet. A packet is 3 to 16 bytes long and consists of a header, a message body, and an end character. The first byte of the command packet is called the command Header. The high half byte is composed of 1 (the highest bit, fixed as 1) and the sender (controller) address (the address is generally 0), the low half byte is composed of 0 and the device (camera) address (or “number”), from the composition format, there are up to 7 cameras that can be connected externally, such as sending a command to the No. 1 camera, the command header is 0x81. The last byte of the command package is the terminal symbol, fixed as 0xff. The middle byte is called the message body. The protocol description documents write the command header as “8x,” where x represents the camera address.
There are two types of commands: general commands and Inquiry commands. The former is to send the command directly to the camera, the latter is to get the data from Autofocus cameras.
The format of the command package is as follows:
8X QQ RR … FF
QQ is the command classification, 01 indicates the common command, 09 indicates the query command. RR Indicates the Category code. X indicates the camera address. The value ranges from 1 to 7.
SONY Autofocus cameras VISCA protocol
Each command has a response package in the following format:
X0 … … FF
Where X ranges from 9 to F, the value is camera number +8. End with FF. The camera returns an ACK when a common command is sent, but the query command does not return an ACK.
ACK response package format: X0 41 FF
The format of the common command response package is X0 51 FF
Query command response package format: X0 51… FF
Where X ranges from 9 to F and is the camera address value +8. The response package of the query command contains data, and each data is different. You can query the protocol document.
The error message format is as follows:
Syntax error: X0 61 02 FF
Command cancel: X0 61 04 FF
No socket: X0 61 05 FF
Command not executed: X0 61 41 FF
Where X has the same value as above. The scope of the “socket” is not well understood at this time. These values are the basis on which the code makes its judgment.
Iii. Remarks of the agreement document
For the description of qprs in the protocol document, it can be directly placed in the 16-bit hexadecimal data (hexadecimal format 0xAAAA). For example, if the response packet format of a command is y0 50 0p 0q 0r0s FF, the actual data is 0xpqrs. For example, 01 02 03 04 is 0x1234. And vice versa. It can be implemented by shifting in the code. Here are some classic command formats:
1. Commands without parameters
Power on the camera CAM_Power command format: 8x 01 04 00 02 FF The x in 8x indicates the camera number. This type of command can be assembled directly according to the command field.
2. Commands with parameters
The CAM_Zoom command is in the format of 8x 01 04 47 0p 0q 0r 0s FF.
The pqrs in 0p 0q 0r0s constitutes the focus position parameter. When assembling the command, shift this parameter to the corresponding field in turn. If the parameter value is 0x1234, the corresponding field is 01 02 03 04.
Using the CAM_AFMode command, you can set the Active and Interval Time values. The format is 8x 01 04 27 0p 0q 0r 0s FF
0p 0q corresponds to movement time and 0r 0s corresponds to Interval. You need to assemble the commands respectively. See above for details.
3. Query commands without parameters
Like the CAM_PowerInq query command, send 8x 09 04 00 FF and return y0 50 02 FF or y0 50 03 FF directly
Where “y0 50 02 FF” is the returned data and the y value is the camera number +8. For such commands, the corresponding state can be obtained by reading the third byte directly.
4. Query commands with parameters
Like CAM_ZoomPosInq, send 8x 09 04 47 FF and return y0 50 0p 0q 0r 0s FF
Most of the query commands contain variable data. 0p 0q 0r 0s in y0 50 0p 0q 0r 0s FF needs to be shifted to know the exact value. The corresponding value is 0xpqrs.