Abstract: AT89C8252 microcontroller based digital video mixer hardware and software design. The application shows that the digital video mixer simple and flexible operation, high reliability, better market value.
Key words: AT89C8252 microcontroller Video Mixer
In recent years, rapid development in digital television technology, digital video mixer can be two or most of the digital video signal according to certain algorithms or multi-channel digital mixing all the way into the video signal. As a basic digital video signal processing unit, the mixer in the digital television program production and broadcast editing control transmission system plays an important role.
This article describes the microcontroller-based digital video keying mixer has the following characteristics: contains two series keying mixer, you can key in the main signal into two two additional digital signals, such as clock station logo or a variety of subtitles Identification; can remote control, key control can also be the scene; can update and save the system configuration, change the system functions and technical parameters; the system is reliable, the power-down, crashes and other anomalies are self-reset capability.
The entire system including hardware and software parts, hardware parts, including digital mixing and MCU control part.
Figure 1 Digital Hybrid hardware diagram Click to enlarge
Digital Hybrid Part 1
Input digital signal to background signals, keying signals and fill signals, digital signals and output three-way all the way analog signals. Part of the hardware block diagram of the digital hybrid such as the power of 1.
GS9020A Serial Digital Video Input Processor is designed to receive the SMPTE 259M serial digital signals. It has error detection and handling capabilities to ensure the integrity of the serial data; or GS9025A GS9035A can be connected directly to provide 8-bit parallel port and I2C serial port with an external microprocessor communications. Read through the I2C bus of the system, configuration GS9020A state.
TMS2081 is a digital video processor, the GBR, YCB, CR or the color sequence format was mixed digital video. a-channel control, according to M = (a) V1 + (1-a) V2 (0 = a = 1) to complete both fade and fade functions. TMS2081 microprocessors I / O port.
Co-processor error detection and handling in accordance SMPTERP-165 GS9021 perform error detection and handling, with GS9002, GS9022 or GS9032 Serial Digital Encoder Interface, resulting in the line sync, vertical blanking and field sequence signal. 8-bit parallel port and I2C serial port with an external microprocessor communications. I2C read by the system, configure the GS9021 state.
SAA7121 is a CMOS chip digital video encoder, the digital luminance and color difference signals simultaneously encoded CVBS and S-video analog signal, and also supports NTSC-M, PAL B / G and sub-standard. Input signal can be YCBCR (CCIR 656) or MPEG decoding data; on the Y, C and CVBS are three data converters. Basic coding function generated by the sub-carrier, color modulation and sync interpolation composition. SAA7121 provides I2C bus interface mode or slave mode can take the initiative to work. The system, through the I2C interface configuration SAA7121.
MCU control part 2
MCU-based control circuit shown in Figure 2. The completion of the following functions: serial communication with the PC, transfer command and data; through the 8-bit parallel interface to read and write TMC2801; through the I2C bus to read and write SAA7121, GS9020A and GS9021; save, update the system configuration data; keying function button to complete the display or do not show additional digital signals.
2.1 AT89S8252 Microcontroller
ATMEL AT89S8252 is an 8-bit CMOS microcontroller company, and MCS-51 series compatible. Main features of film: 8K bytes of FLASH program memory (ROM), 2K bytes of on-chip EEPROM, 256 bytes of internal data memory (RAM), three 16-bit timer / counters, SPI serial interface and look to provide watchdog timer.
Use AT89S8252 reason: on-chip EEPROM data can be saved and the power-down is not lost; watchdog with power-down, crashes and other anomalies from the reset capability, can improve the stability of the mixer; and MCS-51 series compatible.
2.2 Communication Interface
RS-485 communication interface standards, interface circuit mainly by the MAX488 (RS-485 receiver transmitter) form. RS-485 RS-232 standard is not only compatible, and suitable for long-distance transmission of data.
MCU control circuit in Figure 2 Click to enlarge
3 Software Design
Control function according to the requirements of SCM, software serial port interrupt the main program and two subroutines, the main program flow chart shown in Figure 3. Programming focus is: mixer initialization; keying function; of PC to determine and execute the command; update the system configuration and the preservation of data.
3.1 Access EEPROM and watchdog settings
AT89S8252 EEPROM control register with watchdog and WMCON.
; Write a byte
SETB WMCON.3; access to EEPROM enabled
SETB WMCON.4; Write EEPROM Enable
MOVX @ DPTR, A; write a byte address range 0000H ~ 07FFH
JNB WMCON.1 $; WMCON.1, ready for the next visit
CLR WMCON.3; MOVX instruction to access external data memory
Read and write bytes from the EEPROM is similar.
WMCON.0 is the watchdog enable bit, WMCON.1 a watchdog reset bit (MCU reset to 1), WMCON.5 ~ 7 can set the watchdog clock cycle (16 ~ 2048ms). If the watchdog clock cycle, the watchdog reset bit is not set or does not close the watchdog, the internal reset signal will reset the microcontroller.
3.2 Serial Communication with PC
PC data format to communicate with the microcontroller, there are three: the command length + command number; command length + Command + No. of data bytes read the first N + address + checksum; command length + Command + No. of bytes to write numbers first address + N + Data 1 + … + N + checksum data. Command length, order number, read \ u20889 write data bytes N, the first address and data n (1 = n = N) is a byte, 16-band said. The length of the command format command bytes. Checksum = command number + number of data bytes read N + first address, or checksum = command to write data bytes + N + Home Address + Data 1 + … + data N. For example: Display additional digital signal 1 and 1 LED light, PC sends 0×02 0×01; Reading 1 TMC2081 of 00 ~ 03 control memory, PC Send 0×5 0xB 0×4 0×0 0xF; write 0×0 0×21 0x1D 0×0 to the SAA7121 the 27 ~ 2A memory PC sends 0×9 0xC 0×4 0×27 0×0 0×21 0x1D 0×0 0×13.
Click to enlarge the main program flow chart in Figure 3
Serial port interrupt routine in the microcontroller, according to the received command to determine whether the length of receiving a complete command format. If you receive a full command format to set the flag FLG1 (Figure 3) According to the flag into the main program, procedures for dealing with PC command from the received command number to identify a variety of PC to send commands. For example, Order 1, is to show additional digital signal 1 and light 1 LED, 0xC is written SAA7121 Order memory and so on. According to the received checksum, you can determine the accuracy of the data received PC to prevent misuse of the mixer.
Design software with VB6.0, read and write PC’s serial port. This baud rate is 9600bps, the microcontroller timer / counter 2 (T2) to set the baud rate generator work.
3.3 Access TMC2081
TMC2081 provide microprocessor I / O ports, including the read / write control R / W, Chip Select CS, select the control register A [2:0], Data I / O port D [7:0]. Through the microprocessor I / O port access TMC2081 internal control memory, to complete the configuration of the chip. Read and write timing Figure 4.
Parameters tPWLCS, tSA, tSD, tHD, tPWHCS, tHA, tDOM ns minimum time is required level. AT89S8252 can be simulated with software programming to read and write timing of the port configuration TMC2081.
The system uses two TMC2081, marked TMC2081_0 and TMC2081_1. AT89S8252′s P3.6 connected TMC2081_0 / 1 of the R / W, P2.3 even TMC2081_0 the CS, P2.4 even TMC2081_1 the CS, P2 [2:0] with TMC2081_0 / 1 of the A [2:0], P0 [ 7:0] with TMC2081_0 / 1 of the D [7:0] (Figure 2). A-channel memory read and write TMC2081_0 the procedure is as follows:
MC2081_0 EQU P2.3
TMC2081_1 EQU P2.4
R_NW EQU P3.6
MOV A, # 00H
LCALL WADDRTMC2081_0; selected channel control register A
MOV A, # 01H
LCALL WDATMC2081_0; write to the A channel control register 01
MOV A, # 00H
LCALL WADDRTMC2081_0; selected channel control register A
LCALL RDATMC2081_0; Reading A channel control registers
WADDRTMC2081_0: Write the control register address
ORL P2, # 00000111B
MOV P0, A
WDATMC2081_0: write data to the control register
ANL P2, # 11111101B
MOV P0, A
RDATMC2081_0; read control register data
ANL P2, # 11111101B
MOV A, P0
3.4 keying function
There are two keys 1,2. Press the 1 key, 1, display additional LED light and digital signal 1; then 1 button, 1 LED off and the additional digital signal 1 does not appear to restore the background signal. 2 keys are the same, so that can display two additional digital signals. Signal display or blanking process must be present at the falling edge of the first 6 months to complete, to ensure the show or not show the process does not affect the background signal.
Lines simultaneously in P3.3, vertical blanking with counter 1 (T `1), with keys 1,2 P1.6, P1.7, P1.4 and P1.5 to the issue of control level mixer (Figure 2 .) MCU main program to check whether there are key press detection means. If so, enter the key handler, wait for a falling edge of horizontal sync and vertical blanking start the counter counting the falling edge of T1, the counter overflows, P1.4 or P1.5 T1 inversion, given to the control level mixer . The system does not allow synchronization routines triggered external interrupt 1, simply check the falling edge, the actual results show that the query method is more reliable and convenient.
Figure 4 (a) microprocessor interface read timing; (b) microprocessor interface read timing Click to enlarge
3.5 I2C Interface
Philips I2C bus is a serial communication protocol proposed by the company. Through the serial data line (SDA) and serial clock line (SCL) to transfer data. The fastest data transfer rate is 400kbps. P1.0 and P1.1 of the systems on behalf of SDA and SCL, I2C protocol software simulation.
This system makes use of the AT89S8252′s internal resources, not peripheral devices, saving space. Software programming is simple and practical. Microcontroller-based digital video mixer keying Hui from the company production division into KCM-D2000 Digital Key Control Mixer. The application shows that the mixer is stable, convenient, and has achieved good market value.