Sunteți pe pagina 1din 39

VC0706 Serial Port Transmission

Communication Protocol
User Manual
V 3.00

ShenZhen ZhongAnXin Technology Ltd,.

2015.01
Notes1: The information is subject to change without notice. Before using this document, please confirm that
this is the latest version.

Notes2: Not all products and/or types are available in every country. Please check with a ZhongAnXin sales
representative for availability and additional information.

Revision Table
Date Rev. Content of revision Approval
2007-8 1.00 Composing a first draft Mr. Zheng
2011-1 2.00 The second Amendment Mr. Feng
2015-1 3.00 The third revised edition Mr. Lin
Catalogue
Introduce protocol.................................................................................................................................................................. 4
Protocol format ...................................................................................................................................................................... 4
Communication command..................................................................................................................................................... 5
Command list ........................................................................................................................................................................ 5
Command detailed description .............................................................................................................................................. 6
EXIT_HOST_MODE.............................................................................................................................................................. 9
SYSTEM_RESET.................................................................................................................................................................. 9
EXEC_COMM_FORMULA .................................................................................................................................................... 9
READ_DATA ....................................................................................................................................................................... 10
WRITE_DATA ...................................................................................................................................................................... 11
READ_FBUF ....................................................................................................................................................................... 13
WRITE_FBUF ..................................................................................................................................................................... 15
GET_FBUF_LEN ................................................................................................................................................................. 17
SET_FBUF_LEN ................................................................................................................................................................. 18
FBUF_CTRL........................................................................................................................................................................ 18
COMM_MOTION_CTRL ..................................................................................................................................................... 19
COMM_MOTION _STATUS ................................................................................................................................................. 19
COMM_MOTION _DETECTED .......................................................................................................................................... 20
MIRROR_CTRL................................................................................................................................................................... 20
MIRROR_STATUS.............................................................................................................................................................. 21
COLOR_CTRL .................................................................................................................................................................... 21
COLOR_STATUS ................................................................................................................................................................ 22
POWER_SAVE_CTRL ......................................................................................................................................................... 22
POWER_SAVE _STATUS .................................................................................................................................................... 24
AE_CTRL ............................................................................................................................................................................ 25
AE_STATUS ....................................................................................................................................................................... 27
MOTION_CTRL .................................................................................................................................................................. 28
MOTION_STATUS ............................................................................................................................................................... 30
TV_OUT_CTRL ................................................................................................................................................................... 32
OSD_ADDR_CHAR ............................................................................................................................................................ 32
GET_FLASH_SIZE.............................................................................................................................................................. 33
ERASE_FLASH_SECTOR .................................................................................................................................................. 33
ERASE_FLASH_ALL .......................................................................................................................................................... 33
SET_TIME ........................................................................................................................................................................... 34
GET_TIME .......................................................................................................................................................................... 34
ZOOM_CTRL ...................................................................................................................................................................... 34
ZOOM_STATUS................................................................................................................................................................... 35
DOWNSIZE_CTRL .............................................................................................................................................................. 35
DOWNSIZE_STATUS .......................................................................................................................................................... 36
BATCH_WRITE ................................................................................................................................................................... 37
READ_LOGO ...................................................................................................................................................................... 38
SET_BITMAP ...................................................................................................................................................................... 38
Introduce protocol
VC0706 support multiple serial port, and used with the same standard communication protocol in serial
port communication.
We can gain VC0706 information from serial port communication protocol, and make control.
VC0706 communication protocol allowed to connect multiple VC0706 equipment at same time, and the each
equipment can transmission and reception the protocol command.

Protocol format
The document is sending side by client side serial port tool, and VC0706 is reception side. The format of
Serial port communication protocol as follow:
Receive command format: protocol mark(1 byte)+serial data(1 byte)+data length(1 byte) +data (0~16
bytes)
Reply command format: protocol mark(1 byte)+serial data(1 byte)+command word(1 byte)
+condition byte(1 byte)+date length(1 byte)+data(0~16 bytes).
And among them:
Protocol mark: It is used to mark the protocol as VC0706 serial port communication protocol. Receive
protocol mark is 0x56(‘V’); Reply protocol mark is 0x76(‘v’).
Serial data: It is used to differentiate each equipment when many equipment simultaneous
connection. Just the serial data of the serial port command is the same as the serial
data of the equipment, the equipment be able to accept these command. The value
range of the serial data is 0~255.
Command word: It is used to mark specific serial port communication command.
Data length: It show data length, but it not include protocol mark, serial data, command
word and data length. The value range is 0~16.
Data: Command used data, different command with different data length and format,
16 bytes max.
Status byte: Write commands for control commands and data. The data first byte indicates
the command success or not. 0 indicates success. 0x01~0xFF indicates
failure.
Meaning of state type as follow:

State code explanation of error

0 Command execution right

1 Illicit command word, it indicates that the command word system does not support

2 Illicit data length, it indicates that the command does not support the data length

3 Illicit data format

4 The command cannot be executed in the current system state

5 Accept command , but the command execute failure


Explanation:
 About multi-byte data type, Data arrangement is High data in front and low data in behind.
 If serial data error, system don’t return any error report.
 The Max length of the data in the command is 16 bytes.
 If the command format or command execute failed, Then return format is fixed to 1 byte of error code
and 0 byte data length.

Communication command

Command list
User interface command:
Command Definition CW Command meaning
GET_VERSION 0x11 Get Firmware program version
SET_SERIAL_NUMBER 0x21 Set the serial data
SET_PORT 0x24 Set the serial port property
EXIT_HOST_MODE 0x25 Exit the Host control mode
SYSTEM_RESET 0x26 System reset
EXEC_COMM_FORMULA 0x27 Perform the serial port formula
READ_DATA 0x30 Read the equipment's register
WRITE_DATA 0x31 Writes data to equipment registers
READ_FBUF 0x32 Read images from FBUF
WRITE _FBUF 0x33 Write images to FBUF
GET_FBUF_LEN 0x34 Get the length of images in FBUF
SET_FBUF_LEN 0x35 Set the length of images in FBUF
FBUF_CTRL 0x36 Control FBUF
COMM_MOTION_CTRL 0x37 Start or stop the serial port Motion monitoring
COMM_MOTION_STATUS 0x38 Get the Motion monitoring status of the serial port
COMM_MOTION_DETECTED 0x39 When start serial port Motion detection, for the serial
port send detection to Motion
MIRROR_CTRL 0x3A Set image to Mirror display or not
MIRROR_STATUS 0x3B Get states of current image whether Mirror
COLOR_CTRL 0x3C Color control
COLOR_STATUS 0x3D Get the current color control mode and the current color
POWER_SAVE_CTRL 0x3E Control the entry and exit mode of energy saving
POWER_SAVE_STATUS 0x3F Check to see whether enter mode of energy saving
AE_CTRL 0x40 Set the AE related properties
AE_STATUS 0x41 Get the AE related properties
MOTION_CTRL 0x42 Motion control
MOTION_STATUS 0x43 Get Motion states
TV_OUT_CTRL 0x44 Control video on/off
OSD_ADD_CHAR 0x45 Add OSE character
SET_TIME 0x50 Set RTC clock time
GET_TIME 0x51 Get RTC clock time
ZOOM_CTRL 0x52 Zoom control
ZOOM_STATUS 0x53 Zoom state
DOWNSIZE_CTRL 0x54 DownSize control
DOWNSIZE _STATUS 0x55 DownSize state
GET_FLASH_SIZE 0x60 Get the size of SPI Flash
ERASE_FLASH_SECTOR 0x61 Erasure one piece of Flash
ERASE_FLASH_ALL 0x62 Erasure whole Flash
READ_LOGO 0x70 Read LOGO and display
SET_BIZTMAP 0x71 OperateBitmap
BATCH_ WRITE 0x80 Batch write data

Command detailed description


GET_VERSION
Command functions: Get Firmware version number
Command format: 0x56+serial data+0x11+0x00
Reply format: 0x76+serial data+0x11+0x00+0x0B+”VC0706 1.00”
Explanation:
The format of version number: VC0706+spacing+major version number+(1 byte)+’.’+Second
Version number (2 bytes).Total 11 bytes.
Version number is string format, for example: VC0706 1.00
SET_SERIAL_NUMBER
Command functions: Set equipment serial data
Command format: 0x56+serial data+0x21+0x01+new serial data
Reply format: 0x76+serial data+0x21+0x00+0x00
Use the old serial data when the system to reply command;
Use new serial data after system finish reply command.
For example: 0x56+0x00+0x21+0x01+0x10
Change the equipment serial data from 0x00 to 0x10
Explanation: After set new serial data, send new command, need use new serial data.
SET_PORT
Command functions: Set serial port property
Include: MUC serial port, high speed serial port and SPI.
Command format: 0x56+serial data+0x24+data length+ equipment type(1 byte)+layout data
MUC serial port: 0x56+serial data+0x24+0x03+0x01+S1RELH(1 byte)+S1RELL(1 byte)
High speed serial port: 0x56+serial data+0x24+0x05+0x02+FRAC_H(1 byte)+FRAC_L(1 byte)
+INTER_H(1 byte)+INTER_L(1 byte)
SPI: 0x56+serial data+0x24+0x05+0x03+DIVIDER_H(1 byte)+DIVIDER_L (1
byte)+SS_H(1 byte)+SS_L(1 byte)
Equipment type indicates which one will be set from the 3 type equipment
0x01: indicate MCU serial port
0x02: indicate high speed
0x03: indicate SPI
Reply format:
If run correct, then reply: 0x76+serial data+0x24+0x00+0x00
If equipment type sets error, then reply: 0x76+serial data+0x24+0x03+0x00
For example:
0x56+0x00+0x24+0x03+0x01+0x0D+0xA6 Set MCU serial port baud rate to 115200
0x56+0x00+0x24+0x05+0x02+0x00+0x0E+0x02+0x98 High speed serial port baud rate 115200
0x56+0x00+0x24+0x05+0x03+0x00+0x00+0x02+0x00 Set SPI port baud rate to 13.5M
Explanation:
MCU serial port baud rate:
 S1RELH and S1RELL indicate the value to write to the S1RELH and S1RELL register.
 MCU clock is 27M, The relationship between baud rate and the baud rate register as follow:

Baud rate S1RELH S1RELL


9600 0xAE 0xC8
19200 0x56 0xE4
38400 0x2A 0xF2
57600 0x1C 0x4C
115200 0x0D 0xA6
 MCU clock is 36M, The relationship between baud rate and the baud rate register as follow:
Baud rate S1RELH S1RELL
9600 0xE9 0x60
19200 0x74 0x30
38400 0x39 0x98
57600 0x26 0x10
115200 0x12 0x88
High speed serial port baud rate:
 Write separately INTER_H, INTER_L, FRAC_H, FRAC_L to Value of register INTER_H,
INTER_L, FRAC_H, FRAC_L
 Computational formula as follow
DIVISOR = CLK / (BAUD x 16)
INTER = (Integer)DIVISOR
FRAC=(Integer)[(DIVISOR - INTER)*1024]
Explanation: CLK is high speed serial port module, value as 27M
BAUD is the baud rate to set
INTER value write to INTER register
FRAC value write to FRAC register
Integer is Take the whole operation

 The INTER and FRAC of the commonly used baud rates as follow:

Baud rate INTER FRAC


38400 0x002B 0x03C8
57600 0x001D 0x0130
115200 0x000E 0x0298
460800 0x0003 0x02A6
921600 0x0001 0x0353
SPI port baud rate:

 Write separately DIVIDER_H, DIVIDER_L, SS_H, SS_L to Value of register DIVIDER_H,


DIVIDER_L, SS_H, SS_L
 Computational formula as follow
DIVIDER = CLK / (2*BAUD) -1
Explanation: CLK is SPI module clock, value as 27M or 36M
BAUD is the SPI baud rate to set
DIVIDER is value for write to DIVIDER register, Write into SS register default
value is 0x0200
 SPI module clock is 27M, The INTER and FRAC of the commonly used baud rates as follow:

Baud rate DIVIDER SS


0.844 M 0x000F 0x0200
1.688 M 0x0007 0x0200
3.375 M 0x0003 0x0200
6.750 M 0x0001 0x0200
13.500 M 0x0000 0x0200
 SPI module clock is 36M, The INTER and FRAC of the commonly used baud rates as follow:

Baud rate DIVIDER SS


1.125 M 0x000F 0x0200
2.250M 0x0007 0x0200
4.500 M 0x0003 0x0200
9.000 M 0x0001 0x0200
18.000 M 0x0000 0x0200
EXIT_HOST_MODE
Command function: Exit Host control mode

Command format: 0x56+ serial data +0x25+0x00

Reply format: 0x76+ serial data +0x25+0x00+0x00

For example: 0x56+0x00+0x25+0x00 Exit Host control mode

Explanation:

This command is used to pass host flow to open mode or start mode. After finished all the setting in
this mode system, Send the command to the end of the Host configuration operation, make the
system enter the running state.

SYSTEM_RESET
Command function: System reset command. Reset the entire system software and hardware

Command format: 0x56+serial data+0x26+0x00

Reply format: 0x76+serial data+0x26+0x00+0x00

For example: 0x56+0x00+0x26+0x00 system reset

Explanation: About 10 milliseconds later reset the entire system, after return reply

EXEC_COMM_FORMULA
Command function: Execute serial port formula

Command format: 0x56+serial data+0x27+0x00

Reply format: 0x76+serial data+0x27+0x00+0x00

For example: 0x56+0x00+0x27+0x00 Execute serial port formula

Explanation:

After the system receives the command, the system to read the information of formula from the
control information, finished the operation to return the reply command.

If no formula data, then direct return.

The reply time of this command is related to formula data. If have time-out handle, need add
execute time of formula data.
READ_DATA
Command function: read data of chip register, Sensor register, I2C E2prom, SPI equipment or
CCIR656 equipment.

Command format: 0x56+ serial data +0x30+ data length + equipment type(1 byte)+ The number
of data to be read (1 byte)+ configuration information

Equipment type: The type of equipment to access

1: Chip register

2: Sensor register

3: CCIR656 register

4: I2C E2prom

5: SPI E2prom

6: SPI Flash

The command format for different equipment as follow:

Chip register: 0x56+serial data+0x30+0x04+0x01+Read the data quantity+register address


(2 bytes)

Sensor register: 0x56+serial data+0x30+0x05+0x02+Read the data quantity+register data


width (1 byte)+ register address (2 bytes)

CCIR656 equipment: 0x56+serial data+0x30+0x05+0x03+Read the data quantity+register data


width (1 byte)+ register address (2 bytes)

I2C E2prom: 0x56+serial data +0x30+0x04+0x04+Read the data quantity+register address


(2 bytes)

SPI E2prom: 0x56+serial data+0x30+0x04+0x05+ Read the data quantity+register address


(2 bytes)

SPI Flash: 0x56+serial data+0x30+0x06+0x06+ Read the data quantity+register address


(4 bytes)

The number of data read: Represents the number of consecutive reads starting at the specified
address. The number of data read is limited. “The number of data read” x “data wide” can’t greater
than 16 bytes, Otherwise, it can cause the system to go wrong.

About Sensor and CCIR656 equipment, the data width of registers may be different. Register width
represents the data width of each register, value as 1~3 byte.

The number of data: “front data number” x “registers width”.


Reply format:

If running correct, then reply: 0x76+serial data+0x30+0x00+the value of the read register.

If equipment type in the command is incorrect or when operating the Sensor and CCIR656, The
register address width is different from the set in the system, then reply: 0x76+serial data
+0x30+0x03+0x00

The number of data contained in the reply command: “The number of data to be read” x “data width”

For example:

 0x56+0x00+0x30+0x04+0x01+0x02+0x18+0x00

Start reading 2 bytes of data from Chip register address 0x1800

 0x56+0x00+0x30+0x05+0x02+0x01+0x01+0x00+0x20

Start reading 1 byte of data from Sensor register address 0x0020 (Sensor register data
width is 1 byte)

 0x56+0x00+0x30+0x05+0x02+0x02+0x02+0x00+0x20

Start reading 2 bytes of data from Sensor register address 0x0020 (Sensor register data
width is 2 bytes)

 0x56+0x00+0x30+0x05+0x03+0x03+0x01+0x00+0x40

Start reading 3 bytes of data from CCIR656 register address 0x0040 (CCIR656 register
data width is 1 byte)

 0x56+0x00+0x30+0x04+0x04+0x04+0x02+0x40

Start reading 4 bytes of data from I2C E2prom address

 0x56+0x00+0x30+0x04+0x05+0x03+0x08+0x00

Start reading 3 bytes of data from SPI E2prom address

 0x56+0x00+0x30+0x06+0x06+0x08+0x00+0x20+0x40+0x60

Start reading 8 bytes of data from SPI Flash address

WRITE_DATA
Command function: Write data to chip register, Sensor register, I2C of E2prom, SPI
equipment or CCIR equipment.

Command format: 0x56+serial data+0x31+data length+equipment type(1 byte)+The number


of data to be write (1 byte)+configuration information+data
Equipment type: The type of equipment to access

1: Chip register

2: Sensor register

3: CCIR656 register

4: I2C E2prom

5: SPI E2prom

6: SPI Flash

The command format for different equipment as follow:

Chip register: 0x56+serial data+0x31+data length+0x01+The number of data to be write+


register address (2 bytes)+data

Sensor register: 0x56+serial data+0x31+data length+0x02+The number of data to be write+


register width (1 byte)+register address(2 bytes)+data

CCIR656 equipment: 0x56+ serial data +0x31+ data length +0x03+ The number of data to be write
+ register width (1 byte)+ register address (2 bytes) + data

I2C E2prom: 0x56+ serial data +0x31+ data length +0x04+ The number of data to be write +
register address (2 bytes) + data

SPI E2prom: 0x56+ serial data +0x31+ data length +0x05+ The number of data to be write
+ register address (2 bytes) + data

SPI equipment: 0x56+ serial data +0x31+ data length +0x06+ The number of data to be write +
register address (4 bytes) + data

The number of data to be written: Represents the number of consecutive write starting at the
specified address. The number of data write is limited. The number of data written is limited to the
data in the command; they can’t greater than 16 bytes.

When the Sensor and CCIR656 equipment is writing operation, if the data widen greater than 1 byte,
the storage mode in each data of multiple bytes is high data in front and low data in behind.

For SPI equipment (SPI E2prom and SPI Flash), the address of write operation cannot span two 2
pages, Otherwise, it can cause the write in to go wrong. Different SPI equipment has different Page
sizes. For SPI equipment should be attention to write operation of multi-byte.

If run correctly, reply: 0x76+serial data+0x31+0x00+0x00

If equipment type in the command is incorrect or when operating the Sensor and CCIR656, The
register address width is different from the set in the system, then reply: 0x76+serial datas
+0x31+0x03+0x00
For example:

 0x56+0x00+0x31+0x06+0x01+0x02+0x18+0x00+0x11+0x22

Write in 0x11, 0x22 of data from 0x1800 addresses to Chip register address

 0x56+0x00+0x31+0x06+0x02+0x01+0x01+0x00+0x20+0x80

Write in 0x80 of data to Sensor register 0x0020 addresses (Sensor register data width is 1
byte)

 0x56+0x00+0x31+0x09+0x02+0x02+0x02+0x00+0x20+0x01+0x00+0x02+0x00

Write in 0x0100, 0x0200 of data from 0x0020 addresses to Sensor register (Sensor
register data width is 2 bytes)

 0x56+0x00+0x31+0x06+0x03+0x03+0x01+0x00+0x20+0x41+0x42+0x43

Write in 0x41, 0x42, 0x43 of date from 0x0020 address to CCIR656 register (CCIR656
register data width is 1 byte)

 0x56+0x00+0x31+0x08+0x04+0x04+0x02+0x40+0x11+0x12+0x13+0x14

Write in 0x11、0x12、0x13、0x14 of date from 0x0240 address to I2C E2prom

 0x56+0x00+0x31+0x07+0x05+0x03+0x02+0x40+0x21+0x22+0x23

Write in 0x21、0x22、0x23 of date from 0x0240 address to SPI E2prom

 0x56+0x00+0x31+0x0D+0x06+0x07+0x00+0x20+0x40+0x60+0x30+0x31+0x32+0x33+0x3
4+0x35+0x36

It need writing the data from the address 0x00204060 into SPI Flash, according to the
sequential writes 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36. It is total of 7 bytes of data

READ_FBUF
Command function: Read images from FBUF

Command format: 0x56+ serial data +0x32+0x0C+ FBUF frame type (1 byte)+ operating
mode (1 byte)+ start address (4 bytes)+ data length (4 bytes)+ delay time(2 bytes)

FBUF frame type: Which one is the target image between the current frame and next frame?

0: current frame

1: next frame

Operating mode: Indicates transmission mode of FBUF data

Bit0: Indicates whether data is transmitted by DMA


0: The data is transmitted by the MCU

1: The data is transmitted by the DMA

Bit[2:1]: Indicates the port type that receives the image data

2b’01: MCU serial port (just support MCU data read-write mode)

2b’10: High speed serial port (support DMA and MCU data read-write mode)

2b’11: SPI port (support DMA and MCU data read-write mode)

Bit3: When the port of receive image data is SIP port, used to represent equipment
type of SPI connect. For non SPI port, the bit is 1.

0: connect SPI Flash (Indicates the image obtained from reading FBUF is stored in
the SPI Flash)

1: connect SPI Host (Indicates the image read from FBUF is sent out by the SPI
port)

Start address: The starting address of the data read in the FBUF

If the port of receiving image data is SPI port, and connect SPI Flash, This control represents the
starting address of the SPI Flash memory FBUF image. The FBUF read data is fixed at 0 at the start
address of FBUF. So, In this case, the length of the data is generally specified as the length of the
entire image.

Data length: The number of bytes to be read must be multiples of 4.

Delay time: The time interval between the command and the data, the unit is 0.01ms.

Reply format:

If running correctly, reply: 0x76+ serial data +0x32+0x00+0x00 and then send the data.

After sent the data, send the return command to indicate that the data is sent.

If parameter setting or communication error, reply 0x76+ serial data +0x32+ error code +0x01

For example:

 0x56+0x00+0x32+0x0C+0x00+0x0C+0x00+0x00+0x00+0x00+0x00+0x00+0xA0+0xB0+0x
10+0x00

To read FBUF current frame image through MCU serial port by MCU mode. Image data
start from address 0x0000, length is 0xA0B0.

 0x56+0x00+0x32+0x0C+0x01+0x0D+0x00+0x00+0x00+0x10+0x00+0x00+0x02+0x00+0x
10+0x00

To read FBUF next frame image through high speed serial port by DMA mode. Image data
start from address 0x0100, length is 0x0200.

 0x56+0x00+0x32+0x0C+0x00+0x0F+0x00+0x00+0x00+0x10+0x00+0x00+0x02+0x00+0x
10+0x00

To read FBUF current frame image through SPI port by DMA mode. Image data start from
address 0x0100, length is 0x0200.

 0x56+0x00+0x32+0x0C+0x00+0x07+0x00+0x02+0x80+0x00+0x00+0x00+0xB0+0x20+0x
10+0x00

To read FBUF current frame image through SPI port by DMA mode and store to SPI Flash.
The Flash address of storage image data is address 0x28000, length is 0xB020.

Explanation:

The system receives the command, first reply command, then read the specified length data from
FBUF and send it to the set port, after the data is sent, the reply command indicates that the data is
sent.

Must stop the specified frame before invoking the command, Otherwise, images in FBUF have been
updated, it will result in reading image data is wrong.

To read the images in FBUF, can read it all at once through this command, also can be read
multiple times. If use high speed serial port or SPI port as the data read port, recommended read
data by DMA mode.

WRITE_FBUF
Command function: Write images from FBUF

Command format: 0x56+serial data+0x33+0x0B+operating mode(1 byte)+ start address (4


bytes)+ data length (4 bytes)+ delay time(2 bytes)

Operating mode: Indicates the transmission of FBUF data

Bit0: Indicates whether data is transmitted by DMA

0: Through the MCU transmission data

1: Through the DMA transmission data

Bit[2:1]: Indicates the port type of write to image data

2b’01: MCU serial port (Only support MCU data read-write mode)

2b’10: High speed serial port (support DMA and MCU data read-write mode)

2b’11: SPI port (support DMA and MCU data read-write mode)

Bit3: When the port that receives the image data is the SPI port, used to represent
equipment type of SPI connect.

0: Connect SPI Flash (Indicates write the image of in SPI Flash to FBUF)

1: Connect SPI Host (Indicates write the image to FBUF by SPI port)

Bit4: Indicates when the input source is FBUF, this write operation whether is the first
time in the operation of writing images to FBUF.

0: Not first time

1: First time

If the image is written multiple times, set this bit to 1 at the first time, set it to 0 in future operations.

This control is only useful the input source as FBUF, useless other input sources.

Start address: The starting address in FBUF is the data to be read.

It need to send the image data by SPI port, and connect SPI Flash, the control bit represents the
image to be read at the start address of SPI Flash. The FBUF write data is fixed at 0 at the start
address of FBUF. So, In this case, the length of the data is generally specified as the length of the
entire image.

Data length: The number of bytes to be read must be multiples of 4.

Delay time: The time interval between the command and the data, the unit is 0.01ms

Reply format:

If run correctly, reply: 0x76+serial data+0x3+0x00+0x00 and then send the data.

After sent the data, send the return command to indicate that the data is sent.

If parameter setting or communication error, reply 0x76+serial data+0x33+error code+0x01

For example:

 0x56+0x00+0x33+0x0B+0x0C+0x00+0x00+0x00+0x00+0x00+0x00+0xA0+0xB0+0x10+0x
00

Write image to FBUF through MCU serial port by MCU mode. Image data start from
address 0x0000, length is 0xA0B0

 0x56+0x00+0x33+0x0B+0x0D+0x00+0x00+0x00+0x10+0x00+0x00+0x02+0x00+0x10+0x
00

Write image to FBUF through high speed serial port by DMA mode. Image data start from
address 0x0100. Length is 0x0200

 0x56+0x00+0x33+0x0B+0x1D+0x00+0x00+0x00+0x00+0x00+0x00+0x02+0x00+0x10+0x
00
When input source is FBUF, write image to FBUF through high speed serial port by DMA
mode. Image data start from address 0x0000. length is 0x0200. And this operation is the
first time in the whole image writing operation

 0x56+0x00+0x33+0x0B+0x0F+0x00+0x00+0x00+0x10+0x00+0x00+0x02+0x00+0x10+0x0
0

Write image to FBUF through SPI port by DMA mode. Image data start from address
0x0100, length is 0x0200.

 0x56+0x00+0x33+0x0B+0x07+0x00+0x02+0x80+0x00+0x00+0x00+0xB0+0x20+0x10+0x
00

Read image in SPI flash through SPI port by DMA mode and write image to FBUF. The
SPI Flash address of image data is address 0x28000, length is 0xB020.

Explanation:

The system receives the command, first setting relevant, then reply command, then wait for receive
data, then reply command again.

We must to stop the specified image frame before who will invoke this command.

If use high speed serial port or SPI port as the data write port, recommended write data by DMA
mode.

GET_FBUF_LEN
Command function: Gets the size of the image in FBUF

Command format: 0x56+ serial data +0x34+0x01+FBUF frame type (1 byte)

FBUF frame type: Indicates that the image in the current frame or next frame is to be
obtained

0: current frame

1: next frame

Reply format:

If run correctly, reply: 0x76+ serial data+0x34+0x00+0x04+FBUF length (4 bytes)

If the FBUF frame type parameter sets the error, reply: 0x76+ serial data +0x34+0x03+0x00

For example:

0x56+0x00+0x34+0x01+0x00 gets the image length of the current frame

0x56+0x00+0x34+0x01+0x01 gets the image length of the next frame


Explanation:

This command invoking before read FBUF image, used to obtain the length of image in FBUF, in
order to read the FBUF image.

SET_FBUF_LEN
Command function: Set the image size in the next frame of FBUF

Command format: 0x56+serial data+0x35+0x04+FBUF length (4 bytes)

FBUF maximum length is 65535

Reply format: 0x76+serial data+0x35+0x00+0x00

For example:

0x56+0x00+0x35+0x04+0x00+0x00+0xA0+0xB0 Set image length in FBUF to 0xA0B0

Explanation:

The set image size must be the same write the image size of FBUF; otherwise, the final image may
be displayed.

FBUF_CTRL
Command function: FBUF frame control. Include stop frame, Switch frame and Restore frame

Command format: 0x56+serial data+0x36+0x01+control mark (1 byte)

Control marks indicate the type of control for FBUF:

0: Stop current frame

1: Stop next frame

2: Switch frame

3: Restore frame update

Reply format:

If run correctly, reply: 0x76+serial data+0x36+0x00+0x00

If the control marks error, reply: 0x76+serial data+0x36+0x03+0x00

For example:

0x56+0x00+0x36+0x01+0x00 Stop current frame

0x56+0x00+0x36+0x01+0x01 Stop next frame


0x56+0x00+0x36+0x01+0x02 Switch frame

0x56+0x00+0x36+0x01+0x03 Restore frame update

COMM_MOTION_CTRL
Command function: Used to control whether open the Motion monitoring of the serial port

Command format: 0x56+ serial data +0x37+0x01+ control mark (1 byte)

Control mark: Means whether open the Motion monitoring

0: Turn-off

1: Turn-on

Reply format:

If run correctly, reply: 0x76+ serial data +0x37+0x00+0x00

If the control mark set error, reply: 0x76+ serial data +0x37+0x03+0x00

For example:

0x56+0x00+0x37+0x01+0x01 Turn-off serial port Motion detection

0x56+0x00+0x37+0x01+0x00 Turn-on serial port Motion detection

Explanation:

After open the serial port Motion detection, If detect Motion, system will send command
“COMM_MOTION_DETECTED” by serial port.

COMM_MOTION _STATUS
Command function: Obtain current serial port Motion monitoring

Command format: 0x56+ serial data +0x38+0x00

Reply format:

If run correctly, reply: 0x76+ serial data +0x38+0x00+0x01+ control mark (1 byte)

Control mark: Means whether open the Motion monitoring

0: turn-off

1: turn-on

For example:

0x56+0x00+0x38+0x00 Obtain the current state of serial port Motion monitoring


COMM_MOTION _DETECTED
Command function: Means the serial port was detected in Motion

Command format:

After the serial port has been opened, when the system detects Motion, send the command
notification monitor by serial port.

Reply format: 0x76+ serial data +0x39+0x00

For example:

0x76+0x00+0x39+0x00 detected Motion

Explanation:

This command is system actively sent to the control terminal

MIRROR_CTRL
Command function: control Sensor Mirror and Non Mirror display

Command format: 0x56+serial data+0x3A+0x02+control mode(1byte)+Mirror mode (1 byte)

Control mode: Mean control Mirror by serial port or GPIO.

0: by GPIO

1: by serial port

Mirror mode: When control by serial port, it is Mirror display or Non Mirror display.

0: Non Mirror display

1: Mirror display

This control only works when the control mode is by serial port. When control by GPIO, It is set
according to the GPIO value of the control Mirror.

Reply format:

If run correctly, reply: 0x76+ serial data +0x3A+0x00+0x00

If the parameter is error, reply: 0x76+ serial data +0x3A+ error code +0x00

For example:

0x56+0x00+0x3A+0x02+0x01+0x00 set to control the Mirror by serial port, and set to non-
Mirror display

0x56+0x00+0x3A+0x02+0x01+0x01 set to control the Mirror by serial port, and set to Mirror
display

0x56+0x00+0x3A+0x02+0x00+0x00 set to control the Mirror by GPIO

MIRROR_STATUS
Command function: Get Sensor whether Mirror display, and Mirror control mode

Command format: 0x56+Serial data+0x3B+0x00

Reply format: 0x76+Serial data+0x3B+0x00+0x02+control mode(1byte)+Mirror mode


(1 byte)

Control mode: Indicates Mirror control by serial port or GPIO

0: Indicates by GPIO

1: Indicates by serial port

Mirror mode: Indicates current is the Mirror display or non-mirror display

0: Indicates non-mirror display

1: Indicates Mirror display

For example:

0x56+0x00+0x3B+0x00 get current Mirror control mode and Mirror state

COLOR_CTRL
Command function: Set color control mode and color display mode

Command format: 0x56+Serial data+0x3C+0x02+control mode(1byte)+color mode(1 byte)

Control mode: Indicates color control by serial port or GPIO

0: Indicates by GPIO

1: Indicates by serial port

Control mode: When control by serial port, this is the color display mode

0: Indicates Automatic switching black and white and color

1: Indicates Manual switching color, and display color

2: Indicates Manual switching color, and display black and white

This control is only effective when control mode is by serial port. When control by GPIO, then the set
on the basis of control color GPIO value.
Reply format:

If run correctly, reply: 0x76+Serial data+0x3C+0x00+0x00

If the parameter is error, reply: 0x76+Serial data+0x3C+0x03+0x00

For example:

0x56+0x00+0x3C+0x02+0x01+0x00 set to control the color through the serial port, and set up
automatic switch black and white color

0x56+0x00+0x3C+0x02+0x01+0x01 set to control the color through the serial port, and set
color display

0x56+0x00+0x3C+0x02+0x01+0x02 set to control the color through the serial port, and set the
black and white display

0x56+0x00+0x3C+0x02+0x00+0x00 set to control the color through the GPIO

COLOR_STATUS
Command function: Set color control mode and color display mode

Command format: 0x56+Serial data+0x3D+0x00

Reply format: 0x76+Serial data+0x3D+0x00+0x03+control mode(1byte)+color mode


(1 byte)+Current color(1 byte)

Control mode: Indicates color control by serial port or GPIO

0: Indicates by GPIO

1: Indicates by serial port

Control mode: Indicates the current color display mode

0: Indicates Automatic switching black and white and color

1: Indicates Manual switching color, and display color

2: Indicates Manual switching color, and display black and white

For example:

0x56+0x00+0x3D+0x00 Gets the current color control mode and color status

POWER_SAVE_CTRL
Command function: Control whether to enter energy saving mode

Command format: 0x56+Serial data+0x3E+data length+command type(1 byte)+control


item(multi-byte)

Command type: Indicates command type

0: Energy saving mode control

1: Energy saving mode attribute configuration

Control item:

 When command is energy efficient mode control

The first byte is mean that the control of energy saving mode through serial port or GPIO.

0: Indicates by GPIO

1: Indicates by serial port

The second byte is used to indicate whether to enter Power Save state

0: Indicates exit Power Save status

1: Indicates enter the power save status

This control is only effective when control mode is by serial port. When control by GPIO,
then the set on the basis of control energy saving mode GPIO value.

 When command is configured for energy-saving mode properties:

The first byte indicates the energy saving mode control

Bit[1:0]: Selection of energy saving mode

2b’00: Close the relevant modules and outputs behind FBUF

2b’01: Close JPG and output related modules

Bit2: Control to energy-saving mode whether relevance with Motion, if linkage,


then enter energy saving mode in the specified time after no Motion, and
exit the energy saving mode when Motion is detected.

0: Energy-saving mode not linkage with Motion

1: Energy-saving mode linkage with Motion

If want to set energy saving mode relevance with Motion, then energy saving mode control cannot
be Set to GPIO port control. Otherwise the GPIO control will be final.

The second and three bytes indicate, when energy saving mode relevance with Motion, The unit is
10 milliseconds of the time interval from no Motion to the energy saving mode.

Reply format:

If run correctly, reply: 0x76+Serial data+0x3E+0x00+0x00


If the parameter is error, reply: 0x76+Serial data+0x3F+0x03+0x00

For example:

0x56+0x00+0x3E+0x03+0x00+0x01+0x01

The control command of energy saving mode, enter energy saving mode through serial port control

0x56+0x00+0x3E+0x03+0x00+0x01+0x00

The control command of energy saving mode, exit energy saving mode through serial port control

0x56+0x00+0x3E+0x03+0x00+0x00+0x00

The control command of energy saving mode, control energy saving mode through GPIO

0x56+0x00+0x3E+0x04+0x01+0x02+0x01+0x2C

Setting command of energy saving mode attribute

POWER_SAVE _STATUS
Command function: Get current energy saving mode status

Command format: 0x56+Serial data+0x3F+0x01+command type(1 byte)

Command type: Indicates command type

0: Energy saving mode control

1: Energy saving mode attribute configuration

Reply format:

If run correctly, reply: 0x76+Serial data+0x3F+0x00+data length+control item

Control item:

 When command is controlled energy saving mode control:

The first bytes indicate, currently through the serial port or GPIO to carry out the control of
energy-saving mode.

0: indicate through GPIO

1: indicate through serial port

The second bytes indicate Current Power Save status.

0: Not in energy saving mode

1: In energy conservation mode


 When command is configured for energy-saving mode configuration:

The first bytes indicate Current energy-saving mode control.

Bit[1:0]: Selection of energy saving methods

2b’00: Close related modules and outputs behind

2b’01: Close JPG and output related modules

Bit2: Control energy saving mode whether linkage with Motion, If linkage, then
specifying the time enter energy saving mode after no Motion. And exit
the energy saving mode when Motion is detected.

0: Energy saving mode is not linkage with Motion

1: Energy saving mode is linkage with Motion

If you want to set energy saving mode linkage with Motion, Energy saving mode control cannot be
set to GPIO port control; otherwise the GPIO control will be final

The second and three bytes indicate, when energy saving mode relevance with Motion, The unit is
10 milliseconds of the time interval from no Motion to the energy saving mode.

If the parameter is error, reply: 0x76+Serial data+0x3F+0x03+0x0

For example:

0x56+0x00+0x3F+0x01+0x00

Get energy saving mode control mode and energy saving mode state

0x56+0x00+0x3F+0x01+0x01

Get energy saving mode attribute configuration

AE_CTRL
Command function: AE Attribute Control

Command format: 0x56+Serial data+0x40+0x03+AE Attribute(1 byte)+ control mode(1 byte)


+mode setting(1 byte)

AE Attribute: The AE property to be controlled

0: Set 50Hz/60Hz

1: Set automatically switch / force indoor

2: Set backlighting compensation

Control mode: Indicate control this AE attributive through serial port or GPIO
0: GPIO control

1: Serial port control

Mode Set: Set the configuration of AE properties

 When set 50Hz/60Hz:set to 50Hz or 60Hz;

0: 50Hz

1: 60Hz

 When set automatically switch / force indoor: Indicate the mode of switching to set

0: Automatic indoor / outdoor switching

1: Mandatory indoor mode

 When Set backlighting compensation: Indicate Whether to open backlight compensation

0: Close backlight compensation

1: Open backlight compensation

The control item is only valid when control mode is controlled by serial port. When control by GPIO,
the set is based on the GPIO value of control the energy saving mode.

Reply format:

If run correctly, reply: 0x76+Serial data+0x40+0x00+0x01

If the parameter is error, reply: 0x76+Serial data+0x40+0x03+0x00

For example:

0x56+0x00+0x40+0x03+0x00+0x01+0x00 set to serial port control AE 50Hz / 50Hz switching,


and set to 50Hz

0x56+0x00+0x40+0x03+0x00+0x01+0x01 set to serial port control AE 50Hz / 50Hz switching,


and set to 60Hz

0x56+0x00+0x40+0x03+0x00+0x00+0x00 set to GPIO to control AE 50Hz / 50Hz switching

0x56+0x00+0x40+0x03+0x01+0x01+0x00 set to the serial port control indoor/outdoor switch,


and set to automatic indoor/outdoor switch

0x56+0x00+0x40+0x03+0x01+0x01+0x01 set to the serial port control indoor/outdoor switch,


and set to mandatory indoor

0x56+0x00+0x40+0x03+0x01+0x00+0x00 set to GPIO control indoor/outdoor switch

0x56+0x00+0x40+0x03+0x02+0x01+0x00 set to control backlight compensation by serial port,


and set to open backlight compensation
0x56+0x00+0x40+0x03+0x02+0x01+0x01 set to control backlight compensation by serial port,
and set to close backlighting compensation

0x56+0x00+0x40+0x03+0x02+0x00+0x00 set to GPIO to control backlight compensation

AE_STATUS
Command function: Get specified AE attribute configuration

Command format: 0x56+serial data+0x41+0x01+AE attributive(1 byte)

AE attribute: AE attribute control

0: Set 50Hz/60Hz

1: Set automatic switching / forcing indoor

2: Set backlighting compensation

Reply format:

If run correctly, reply: 0x76+serial data+0x41+0x00+0x03+AE attribute(1 byte)+ control mode(1


byte)+ Mode Set(1 byte)

AE attribute: AE attribute of currently need to be control

0: Set 50Hz/60Hz

1: Set automatic switching / forcing indoor

2: Set backlighting compensation

Control mode: Indicate control this AE attribute through serial port or GPIO

0: GPIO control

1: Serial port control

Mode Set: Set the currently configuration of AE attribute

 When set 50Hz/60Hz:currently is 50Hz or 60Hz;

0: 50Hz

1: 60Hz

 When set automatically switch / force indoor: Indicate the current mode of switching

0: Automatic indoor / outdoor switching

1: Mandatory indoor mode


 When Set backlighting compensation: Indicate Whether to open backlight compensation

0: Close backlight compensation

1: Open backlight compensation

If the parameter is error, reply: 0x76+serial data+0x41+0x03+0x00

For example:

0x56+0x00+0x2D+0x01+0x00 get AE 50Hz / 60Hz control mode and current state

0x56+0x00+0x2D+0x01+0x01 get indoor/outdoor switch control and current state

0x56+0x00+0x2D+0x01+0x02 get backlight compensation control mode and current state

MOTION_CTRL
Command function: Motion control

Command format: 0x56+ serial data +0x42+ data length +Motion Control Attribute + control
item

Motion Control Attribute: Motion control command

0: Motion control method and enabled control

1: Set alarm output attribute

2: Alarm output enabled control

3: Alarm output control

Control item: Indicate the configuration of the Motion control attribute to be set

 Indicate Motion control method and enabled control

The first byte indicate GPIO control or serial port control

0: GPIO control

1: serial port control

The second byte represents if is serial port control, need to set Motion Enabling state

0: Forbid Motion detection

1: Open Motion detection

 Indicate the setting of the alarm output attribute

The first byte indicates the alarm method:


Bit0:Alarm method

0: Stop the alarm after the alarm is specified time

1: Continue alarm Bit1: alarm level

0: Normal output of low level output, Output high level when alarm

1: Normal output high level output, output low level when alarm

The second and three bytes indicate the alarm time: Data storage mode is high in front,
low behind, unit is 10ms.

 Indicate alarm output enabled control

The first byte indicates whether to open or close the alarm output function

0: Forbid alarm output

1: Enabled alarm output

 Indicate alarm output control

The first byte means to open or close the alarm output

0: Stop alarm output

1: Start alarm output

Reply format:

If run correctly, reply: 0x76+serial data+0x42+0x00+0x00

If the parameter is error, reply: 0x76+serial data+0x42+0x03+0x00

For example:

0x56+0x00+0x42+0x03+0x00+0x01+0x01

Sets the enabling of Motion detection for the serial port, and turn on Motion detection

0x56+0x00+0x42+0x03+0x00+0x01+0x00

Sets the enabling of Motion detection for the serial port , and turn off Motion detection

0x56+0x00+0x42+0x03+0x00+0x00+0x00

Sets the enabling of GPIO controls Motion detection

0x56+0x00+0x42+0x03+0x01+0x02+0x00+0x64 set the alarm output attribute

0x56+0x00+0x42+0x03+0x02+0x01 set to turn on alarm output function

0x56+0x00+0x42+0x03+0x02+0x00 set to turn off alarm output function

0x56+0x00+0x42+0x03+0x03+0x01 Start alarm output


0x56+0x00+0x42+0x03+0x03+0x00 Stop alarm output

Explanation:

If the alarm output is to be used, please distribute GPIO port for alarm output.

MOTION_STATUS
Command function: Get the configuration for the specified Motion attribute

Command format: 0x56+serial data+0x43+0x01+Motion Control Attribute

Motion Control Attributes: Motion control command

0: Motion control method and enabled control

1: Set alarm output attribute

2: Alarm output enabled control

3: Alarm output control

Reply format:

If run correctly, reply: 0x76+serial data+0x43+0x00+data length+Motion Control Attribute+control


item

Motion control attribute: Motion control command

0: Motion control method and enabled control

1: Set alarm output attribute

2: Alarm output enabled control

3: Alarm output control

Control item: The first byte indicate GPIO control or serial port control

0: GPIO control

1: serial port control

The second byte indicate the current state

0: Forbid Motion detection

1: Open Motion detection

Bit0 indicate Motion detection was opened

0: Forbid Motion detection


1: Open Motion detection

Bit4 indicate whether Motion was detected

0: Motion was not detected

1: Motion was detected

Control item: Set Alarm output attribute

The first byte indicates alarm method:

Bit0: Alarm method

0: Stop the alarm after the alarm is specified time

1: Continue alarm

Bit1: Alarm level

0: Normal output of low level output, Output high level when alarm

1: Normal output high level output, output low level when alarm

The second and three bytes indicate the alarm time: high in front, low behind, unit is 10ms.

Control item: Alarm output control

The first byte indicates whether to open or close the alarm output function

0: Forbid alarm output

1: Enabled alarm output

Control item: Alarm output control

The first byte means to open or close the alarm output

0: Stop alarm output

1: Start alarm output

If the parameter is error, reply: 0x76+serial data+0x43+error code+0x00

For example:

0x56+0x00+0x43+0x01+0x00 Gets the current control mode of Motion and current


Motion detection state whether open

0x56+0x00+0x43+0x01+0x01 Get the current alarm output attribute

0x56+0x00+0x43+0x01+0x02 Get the enabled statue of the alarm output function

0x56+0x00+0x43+0x01+0x03 Get the current whether start alarm output


TV_OUT_CTRL
Command function: TV output control

Command format: 0x56+ serial data +0x44 +0x01+ control item(1byte)

Control item: Control TV output Turn off / on

0: Turn off TV output

1: Turn on the TV output

Reply format:

If run correctly, reply: 0x76+serial data+0x44+0x00+0x00

If the parameter is error, reply: 0x76+serial data+0x44+0x03+0x00

For example:

0x56+0x00+0x44+0x01+0x01 Turn off TV output

0x56+0x00+0x44+0x01+0x00 Turn on the TV output

OSD_ADDR_CHAR
Command function: Add OSD characters to the OSD character channel (channel 1)

Command format: 0x56+serial data+0x45+data length+character data(1 byte)+ start


address(1 byte)+character(n character)

Character format: Indicate the number of characters written continuously, maximum 14

Start address: Indicate the starting address of the character to display. Indicate format:

Bit[4-0]: Indicate the column coordinates of the character in a line of the character
channel

Bit[6-5]: The line of the character channel that the

Character: character of need to display, the character format is 703 OSD.

Reply format:

If run correctly, reply: 0x76+serial data+0x45+0x00+0x00

If the parameter is error, reply: 0x76+serial data+0x45+0x03+0x00

For example:

0x56+0x00+0x45+0x07+0x06+0x24+0x1F+0x2C+0x30+0x2C+0x26+0x35+0x32

Start writing "VIMICRO" 7 characters to column 4 of line 2 of the character channel


Explanation:

Before adding OSD characters, need to set up the OSD module

GET_FLASH_SIZE
Command function: Get SPI Flash size

Command format: 0x56+serial data+0x60+0x00

Reply format: 0x76+serial data+0x60+0x00+0x04+Flash size(4 bytes)The returned


Flash size unit is K bytes

For example:

0x56+0x00+0x60+0x00 Get SPI Flash size

Explanation:

The system can only recognize the capacity of part SPI Flash. For SPI Flash that cannot be
recognized, the length get from this command is 0

ERASE_FLASH_SECTOR
Command function: Erase the Sector that SPI Flash specifies

Command format: 0x56+serial data+0x61+0x04+start address(4 bytes)

Start address: Indicate the Sector start address of need to be erased

Reply format: 0x76+serial data+0x61+0x00+0x00

For example: 0x56+0x00+0x61+0x04+0x00+0x01+0x00+0x00

Erase the Sector that starts at 0x10000 addresses in SPI Flash

ERASE_FLASH_ALL
Command function: Erase the whole SPI Flash

Command format: 0x56+serial data+0x62+0x00

Reply format: 0x76+serial data+0x62+0x00+0x00

For example: 0x56+0x00+0x62+0x00

Erase the whole SPI Flash


SET_TIME
Command function: Set RTC time

Command format: 0x56+serial data+0x50+0x07+year (2 bytes)+month (1 byte)+day


(1 byte)+hour(1 byte)+minute (1 byte)+ second (1 byte)

Hour: 24 hour system

Reply format: 0x76+serial data+0x50+0x00+0x00

For example: 0x56+0x00+0x50+0x07+0x07+0xD8+0x08+0x08+0x17+0x3B+0x3B

Set time: 2008, August 8th, 23 o’clock, 59 minute, 59 second

GET_TIME
Command function: Get current RTC time

Command format: 0x56+serial data+0x51+0x00

Reply format: 0x76+serial data+0x51+0x00+0x07+year(2 bytes)+month(1 byte)+day


(1 byte)+hour(1 byte)+ minute(1 byte)+second(1 byte)

For example: 0x56+0x00+0x51+0x00 Get current RTC time

ZOOM_CTRL
Command function: Zoom control

Command format: 0x56+serial data 0x52+0x08+Zoom Width(2 bytes)+hStart Pos (2


bytes)+vStart Pos(2 bytes)

ZoomWidth: Image width after Zoom, The value must be a multiple of 16, and not
greater than the width of the image in FBUF

ZoomHeight: Image height after Zoom, The value must be a multiple of 8, and not
greater than the height of the image in FBUF

hStartPos: The initial X coordinates of the image in FBUF image after Zoom. The
value must be a multiple of 2.

vStartPos: The initial X coordinates of the image in FBUF image after Zoom. The
value must be a multiple of 8.

Note: The sum of Zoom Width and hStartPos can’t exceed the Width of the image in FBUF

The sum of Zoom Height and vStartPos can’t exceed the height of the image in FBUF
Reply format:

If run correctly, reply: 0x76+serial data+0x52+0x00+0x00

If the image doesn't pass FBUF, Zoom is not allowed, reply:0x76+serial data+0x52+0x04+0x00

For example: 0x56+0x00+0x52+0x08+0x01+0x40+0x00+0xF0+0x00+0x40+0x00+0x20

After Zoom, Set image width is 320, height is 240, initial position X-coordinate is 64, Y-coordinate is
32

ZOOM_STATUS
Command function: Get the configuration for the Zoom attribute

Command format: 0x56+serial data+0x53+0x00

Reply format:

If run correctly, reply: 0x76+serial data+0x53+0x00+0x0C+image attributes(12 bytes)

Image attributes: 12-byte Image correlation attribute, Each attribute item is 2 bytes

byte 1,2: SrcWidth, Original image width, image width in FBUF

byte 3,4: SrcHeight, Original image height, image height in FBUF

byte 5,6: ZoomWidth, Zoom window width

byte 7,8: ZoomHeight, Zoom window height

byte 9,10: hStartPos, The Zoom window is the x-coordinate of the starting position in
the FBUF image

byte 11,12: vStartPos, The Zoom window is the x-coordinate of the starting position in
the FBUF image

If the image doesn't pass FBUF, Zoom is not allowed, reply: 0x76+serial data+0x53+0x04+0x00

For example: 0x56+0x00+0x53+0x00 Get the current Zoom state

DOWNSIZE_CTRL
Command function: DownSize control, the width and height of the image that will enter the
LBUF JPE module are to zoom, then Put in FBUF module.

Command format: 0x56+serial data+0x53+0x01+DownSize control item(1 byte)

DownSize control item: Set image scaling


Bit[1:0]: Image width scaling

2b’00: 1:1, Don't scale

2b’01: 1:2, scale to 1/2 than original image

2b’10: 1:4, scale to 1/4 than original image

2b’11: Reservation

Bit[3:2]: Image height scaling

2b’00: 1:1, Don't scale

2b’01: 1:2, scale to 1/2 than original image

2b’10: 1:4, scale to 1/4 than original image

2b’11: Reservation

Note:

 The width of the image in the FBUF must be a multiple of 16, The height must be a multiple of 8.
So when set the DownSize, must ensure that the width of the image after DownSize can
satisfies this condition

 In the control item, set the height scaling cannot be larger than the width scaling

Reply format: 0x76+serial data+0x53+0x00+0x00

For example:

0x56+0x00+0x53+0x01+0x05 Scale the image width and height to 1/2 than original image

DOWNSIZE_STATUS
Command function: Gets the configuration for the DownSize attribute

Command format: 0x56+ serial data +0x54+0x00

Reply format: 0x76+ serial data +0x54+0x00+0x01+ DownSize control item(1 byte)

DownSize control item: Set the image scaling

Bit[1:0]: Image width scaling

2b’00: 1:1, Don't scale

2b’01: 1:2, scale to 1/2 than original image

2b’10: 1:4, scale to 1/4 than original image

2b’11: Reservation
Bit[3:2]: Image height scaling

2b’00: 1:1, Don't scale

2b’01: 1:2, scale to 1/2 than original image

2b’10: 1:4, scale to 1/4 than original image

2b’11: Reservation

For example: 0x56+0x00+0x54+0x00 Get the current DownSize configuration

BATCH_WRITE
Command function: Write the data of the batch data format, and start the write operation

Command format: 0x56+serial data+0x50+0x04+data length (2 bytes)+ delay time(2 bytes)

Data length: The total length of the data written into the batch register, the maximum
value is 400 bytes

Delay time: After the system receives the data, delay the specified time, then send
the reply commander, the unit is 0.01 milliseconds

After the system receives the command, make relevant Settings, and then reply to command, and
then wait for receiving data. After receiving the data, perform batch write operations, and then reply
to command.

Reply format:

If run correctly, reply: 0x76+serial data+0x50+0x00+0x00 then wait for receiving data. After
receiving the data and perform batch write operation, reply again: 0x76+ serial data
+0x50+0x01+0x00

If the data length set is greater than 400, reply: 0x76+serial data+0x50+error code+0x00

For example:

0x56+0x00+0x50+0x04+0x00+0x64+0x03+0xE8 Batch writes format data of write 100 bytes

Explanation:

Batch data is batch write data format. Write the register a series of operation to batch write data
format, and then sent by the command. After System receiving the data again, will parse and
complete the corresponding register write operation
READ_LOGO
Command function: Read the Logo from the control information and display it

Command format: 0x56+serial data+0x70+0x06+data size(2 bytes)+start address(4 bytes)

Data size: Logo data length

Start address: Logo data initial position in the control message

Reply format: 0x76+serial data+0x70+0x00+0x00

The system will to command responds after the Logo read the OSD from the control information

For example: 0x56+0x00+0x70+0x06 +0x02+0x00+0x00+0x00+080+0x00

Start reading 512 byte of Logo data into OSD from 0x800 address control information, and display.

SET_BITMAP
Command function: Operate Bitmap. Read Bitmap from the control information and control the
Bitmap display.

Command format: 0x56+ serial data +0x71+ data length + operation type(1 byte)+ data
size(2 bytes)+start address(4 bytes)

Operation type: Bitmap operation type

1: Stop transfer Bitmap from SPI Memory(SPI E2prom or SPI Flash), and stop Bitmap display.

2: Start transfer Bitmap from SPI Memory(SPI E2prom or SPI Flash), and open Bitmap display

3: Transfer Bitmap data by SPI Host

Data size: The Bitmap length of need to be transmitted. When the operation type is 1,
there is no this control

Start address: Initial position of Bitmap data of need to be remitted in SPI Memory. Only
operation type 2 needs this control item.

The command of reads Bitmap from SPI Memory and display:

0x56+ serial data +0x71+0x07+0x02+ data size(2 bytes)+start address(4 bytes)

Stop the Bitmap display command: 0x56+serial data+0x71+0x01+0x01

Transfer Bitmap by SPI Host command: 0x56+serial data+0x71+0x03+0x03+data size(2 bytes)

Reply format:

If run correctly, reply: 0x76+serial data+0x71+0x00+0x00

If the parameter is wrong, reply: 0x76+serial data+0x71+0x03+0x00


For example:

 0x56+0x00+0x71+0x01+0x01

Stop Bitmap display

 0x56+0x00+0x71+0x07+0x02+0x25+0x80+0x00+0x00+0x40+0x00

Read Bitmap with a length of 0x2580 bytes from SPI Memory address 0x4000, and display

 0x56+0x00+0x71+0x03+0x04+0x25+0x80

Transfer 0x2580 byte length Bitmap by SPI Host, and display

Explanation:

If Bitmap display is started and the way is read SPI Memory, then the SPI channel is monopolized, it
can’t make SPI Memory Read and write access. If want to read and write the SPI Memory, must
stop the Bitmap display.

VC0706 Serial Port Transmission Communication Protocol has end .


Please contact us if you got any questions!

Thank you very much!

Company Website: www.zaxbefore.com

Technology E-mail: fengchun@zaxbefore.com

S-ar putea să vă placă și