Initialization and control of video decoding chip SAA7113

This article refers to the address: http://

Abstract : This paper first briefly introduces the characteristics and application of video decoder chip SAA7113, then introduces the register configuration during initialization, uses 51 single-chip microcomputer to control 7113 method, and finally gives the initialization program and control method of 7113.
Keywords: video decoding SAA7113 I2C bus initialization

introduction:
SAA7113 is a kind of video decoding series chip of Philips company. It is very representative. It is used in many video products such as TV card, MPEG2, MPEG4. After familiar with the principle of 7113, the Other series of chips SAA7114, 7115, 7118 It will be easy to understand. The main function of the SAA7113 is to decode the input analog video signal into a standard "VPO" digital signal, which is equivalent to an "A/D" device. 7113 is compatible with various video standards all over the world. In China, it is necessary to configure internal registers according to China's video standards, that is, initialization. Otherwise, 7113 cannot output as required. It can be said that the main work of R&D on 7113 is how to initialize. The initialization of 7113 needs to be performed through the I2C bus. This article gives an example of control with 51 MCU.

1. The basic principle and application of SAA7113 SAA7113 is a video decoding chip, which can input 4 analog video signals, and can convert 4 inputs through different configurations of internal registers. The input can be 4 CVBS or 2 S video (Y /C) Signal, output 8-bit "VPO" bus, standard ITU 656, YUV 4:2:2 format.

The 7113 is compatible with PAL, NTSC, and SECAM systems. It can automatically detect 50 or 60 Hz for field frequency and can automatically switch between PAL and NTSC. The 7113 has a series of registers inside, which can be configured as different parameters. The control of chromaticity and brightness is performed by rewriting different values ​​to the corresponding registers. The reading and writing of the registers needs to be performed through the I2C bus.

Both the analog and digital sections of the 7113 are powered by +3.3V, the digital I/O interface is compatible with +5V, with 0.4W for normal operation and 0.07W for idle. The 7113 requires an external 24.576MHz crystal and has a phase-locked loop (LLC) inside to output a 27MHz system clock. The chip has a power-on automatic reset function, and an external reset pin (CE), a low-level reset. After the reset, the output bus becomes tri-state, and the reset signal automatically recovers when the reset signal becomes high. The clock is lost and the power supply voltage is lowered. Automatic reset. The 7113 is a QFP44 package.
A typical application for the 7113 is shown below.


2. Brief description of the SAA7113 register
The address of SAA7113 starts from 00H, among which 14H, 18H~1EH, 20H~3FH, 63H~FFH are reserved addresses, which are not used. 00H, 1FH, 60H~62H are read-only registers, only the following registers can be read and written: 01H ~05H (front-end input channel section), 06H~13H, 15H~17H (decoding part), 40H~60H (normal separation data section).

The following list briefly describes the registers in 7113. The default value is the default value of the register after the chip reset. The setting value can be applied to the setting parameters of the PAL system in China. These parameters are for reference only. For details, please refer to the 7113 data sheet. Some parameters such as brightness can be changed as needed by the user.

3. How to configure the SAA7113 register
The register configuration of SAA7113 is performed through the I2C bus, which complies with the I2C bus protocol. The following describes the operation format from two aspects: read and write:

"Write" operation on the 7113 register:

  S

Slave address W

ACK-S

Subaddress

ACK-S

Data

ACK-S

  P

"Read" operation on the 7113 register:

S

Slave address W

ACK-S

Subaddress

ACK-S

Sr

Slave address R

ACK-S

Data

ACK-m

P


Description: S: Start bit, the condition is that SDA has a falling edge when SCL is high;
Sr: repeat a start bit
Slave address W: 7113 chip address + write flag, 0100 1010 = 4AH, if RTS0 is grounded through a 3.3K resistor, it is 48H;
Slave address R: 7113 chip address + write flag, 0100 1011 = 4BH, if RTS0 is grounded through a 3.3K resistor, it is 49H;
ACK-S: 7113 generated response signal;
ACK-m: the response signal generated by the host;
Subaddress: register address;
P: stop bit, the condition is that SDA has a rising edge when SCL is high;
When operating on multiple registers, the register address is automatically incremented by one.

4. Initialization and control of 7113 with 51 single chip microcomputer
The initialization of the SAA7113 is to configure the appropriate parameters for the registers to enable them to have the desired output. The register configuration is performed by the I2C bus. Many devices that can control the I2C bus can be used as the master device to initialize the 7113. Here, an example of initializing the 7113 with the 51 microcontroller is described.

The hardware connection between 51 MCU and 7113 is very simple. Just connect the two I/O ports of the MCU (such as P1.0 and P1.0) directly to the SCL and SDA pins of 7113, and then add the pull-up resistor.

The main task of initializing 7113 with a single-chip microcomputer is to write the program. First, you must be familiar with the I2C bus protocol. Write the subroutine of start, stop, and acknowledge signals according to the principle of the I2C bus. Write and receive 1 byte by the subroutine. The program then writes out the program for reading and writing registers according to the register operation format of 7113, and finally writes the program segment of initialization 7113 according to the above subroutine.

The control of 7113 is generally to change the chromaticity, brightness and other indicators and the output signal of the output pin. This can be done by modifying the value of the corresponding register, and the program can write "read and write commands".

The specific example of initializing the SAA7113 and reading and writing registers is given below in the form of a block for reference.
SDA BIT P1.0
SCL BIT P1.1
I2C_ERROR BIT 00H ; I2C bus data transmission error flag
DeviceaddressW EQU 4AH; 7113 device address + write
DeviceaddressR EQU 4BH; 7113 device address + read
Subaddress EQU 4DH; 7113 register address byte in the storage address of the microcontroller
DATA_I2C EQU 50H ; Set the address where the write or read data is stored in the MCU

;*************start up**************
I2C_START: SETB SDA
NOP
SETB SCL
NOP
CLR SDA
NOP
CLR SCL
RET
;***************stop**************
I2C_STOP: CLR SDA
NOP
SETB SCL
NOP
SETB SDA
NOP
RET
;************ Send a response bit **************
SEND_ACK: CLR SCL
NOP
CLR SDA
NOP
SETB SCL
NOP
NOP
CLR SCL
NOP
SETB SDA
RET
;***********Send non-response bit***********
SEND_NOACK: SETB SDA
NOP
SETB SCL
NOP
NOP
CLR SCL
NOP
RET
;***********Check the response bit **************
CHECK_ACK: NOP
CLR SCL
NOP
SETB SDA
NOP
SETB SCL
NOP
NOP
MOV C, SDA
MOV I2C_ERROR, C
CLR SCL
NOP
RET
;*******Send 1 byte of data, pending data in A******
I2C_SEND_1BYTE:
MOV R0, #8
SEND100: RLC A
MOV SDA, C
NOP
SETB SCL
NOP
NOP
CLR SCL
DJNZ R0, SEND100
RET
;******* Receive 1 byte of data, receive data in A*****
I2C_RECEIVE_1BYTE:
MOV R0, #8
RECV100: SETB SDA
NOP
SETB SCL
NOP
NOP
NOP
MOV C, SDA
CLR SCL
RLC A
DJNZ R0, RECV100
RET
;*******Write a byte of data to a register via the I2C bus*********
I2C_WRITE: ACALL I2C_START ; Start signal MOV A, # DeviceaddressW ; Adjust 7113 address + Write ACALL I2C_SEND_1BYTE ; Send 7113 address and "write" command ACALL CHECK_ACK ; Check 7113 response signal JNB I2C_ERROR, WR200 ;
WR100: ACALL I2C_STOP ; the answer is incorrect, return RET
WR200: MOV A, Subaddress ; adjust register address ACALL I2C_SEND_1BYTE; send register address ACALL CHECK_ACK; check 7113 response signal JB I2C_ERROR, WR100; acknowledgment is incorrect, return MOV A, DATA_I2C; adjust the data to be written ACALL I2C_SEND_1BYTE; send data word Section ACALL CHECK_ACK
JB I2C_ERROR, WR100
ACALL I2C_STOP; send stop signal RET
;*******Reading the data of a certain register through the I2C bus*********
I2C_READ: ACALL I2C_START
MOV A, # DeviceaddressW ; Adjust 7113 address, write ACALL I2C_SEND_1BYTE
ACALL CHECK_ACK
JNB I2C_ERROR, RD200
RD100: ACALL I2C_STOP
RET
RD200: MOV A, Subaddress ; adjust the register address to be read ACALL I2C_SEND_1BYTE ; Transmit register address byte ACALL CHECK_ACK
JB I2C_ERROR, RD100
ACALL I2C_START ;Resend start signal MOV A, # DeviceaddressR ; Adjust 7113 address, read ACALL I2C_SEND_1BYTE
ACALL CHECK_ACK
JB I2C_ERROR, RD100
ACALL I2C_RECEIVE_1BYTE ; Receive read data MOV DATA_I2C, A ; Read data dump ACALL SEND_NOACK ; Send non-acknowledge bit ACALL I2C_STOP ; Stop RET
;***************Initialize 7113, configure each register **************************
INIT_SAA7113: MOV DPTR, #SAA7113_Subaddress
MOV R7, #28
INIT100: MOV A, #0
MOVC A, @A+DPTR
MOV Subaddress, A ; Tun register address MOV A, #28
MOVC A, @A+DPTR
MOV DATA_I2C, A ; Tun Register Configuration Data INC DPTR
ACALL I2C_WRITE ; configure 1 register JB I2C_ERROR, INIT200
DJNZ R7, INIT100
INIT200: RET
;***************SAA7113 register initialization configuration data *********************
SAA7113_Subaddress:
DB 01H, 02H, 03H, 04H, 05H, 06H, 07H, 08H, 09H, 0AH, 0BH, 0CH, 0DH, 0EH
DB 0FH, 10H, 11H, 12H, 13H, 15H, 16H, 17H, 40H, 58H, 59H, 5AH, 5BH, 5EH
28 in total
I2C_REG_VALUE_AI11:
DB 08H,0C0H,33H,00H,00H,0EBH,0E0H,0B8H,01H,7EH,46H,43H,01H,01H
DB 0FH, 00H, 0CH, 0A7H, 00H, 00H, 00H, 00H, 02H, 00H, 54H, 07H, 80H, 00H
;*************Rewriting and reading out a register of SAA7113*******************
WRITE_READ: MOV Subaddress, #0AH ; Set the register address to 0AH
MOV DATA_I2C, #88H ; Change the value of the register to 88H
ACALL I2C_WRITE ; rewrite ACALL I2C_READ ; read
Conclusion
SAA7113 can be applied in many products, but the principle of initialization and control is the same. The program segment in this paper can guarantee the normal operation of 7113 through practical application. The register setting parameters and control methods can be used for reference or directly applied.

references
1. Chen Luchen, ed. Computer Communication Interface Technology. Chengdu: University of Electronic Science and Technology Press, 1999
2. Zhang Hongrun, editor. Single-chip application technology tutorial. Beijing: Tsinghua University Press, 1997
3. SAA7113H Product specification / Data sheet . PHILIPS, 1999

Humidifier & Dehumidifier

Lanhai Compressor Co., Ltd. , http://www.jhcompressor.com