// TVP5154A WSS/CGMS Example
#define TVP5154A 0xB8;
// TVP5154A main I2C address
byte I2C_RegAddress,Status;
byte I2C_Data;
int CRAM_Address, count;
// recommended WSS/CGMS settings
byte WSS_ARRAY[]={0x38,0,0x3F,0,0,0x71,0x6E,0x43,0x63,0x7C,0x08,0,0,0,0x39,0};
byte WSSData[3];
// data array for WSS/CGMS
////////////////////////////////////////////////////////////////////////////////
// initialize
////////////////////////////////////////////////////////////////////////////////
// load WSS/CGMS C-RAM
I2C_RegAddress = 0xD0;
// starting address of Line Mode registers
I2C_Data = 0xFF;
For (count = 0; count < 44; count ++)
{
I2CWriteByte(TVP5154A, I2C_RegAddress, I2C_Data);
//write FFh to Line Mode registers
I2C_RegA+;
}
I2CWriteByte(TVP5154A, 0xCF, 0);
// disable full field mode
CRAM_Address = 0x130;
// address of NTSC WSS/CGMS C-RAM block
I2CWriteByte(TVP5154A, 0xC4, 0x30);
// load C4h with C-RAM address[7:0]
I2CWriteByte(TVP5154A, 0xC5, 0x01);
// load C5h with C-RAM address[8]
For (count = 0; count < 16; count++)
{
I2CWriteByte(TVP5154A, 0xC3, WSS_ARRAY[count]);
// write 16 bytes of WSS/CGMS C-RAM
}
// data to register C3h.
I2CWriteByte(TVP5154A, 0xCB, 0x4E);
// Set Pixel Alignment[7:0]to 0x4E
I2CWriteByte(TVP5154A, 0xCC, 0x00);
// Set Pixel Alignment[9:8]to 0x00
// NTSC WSS/CGMS Line Mode setup for line 20 of both fields
I2CWriteByte(TVP5154A, 0xEC, 0x09);
// line 20 field 1 (0xEC), mode bits = 0x09
I2CWriteByte(TVP5154A, 0xED, 0x09);
// line 20 field 2 (0xED), mode bits = 0x09
// PAL WSS/CGMS Line Mode setup for line 23 (source input) of both fields.
// PAL line numbering has 3 line offset so the Line 26 line mode registers are used.
I2CWriteByte(TVP5154A, 0xF8, 0x08);
// line 26 field 1 (0xF8), mode bits = 0x08
I2CWriteByte(TVP5154A, 0xF9, 0x08);
// line 26 field 2 (0xF9), mode bits = 0x08
I2CWriteByte(TVP5154A, 0xCD, 0x01);
// disable ANC data, enable FIFO access.
//////////////////////////////////////////////////////////////////////////////////////
// check status and get sliced data
//////////////////////////////////////////////////////////////////////////////////////
I2CReadBuffer(TVP5154A,0xC6,&Status,1);
//read 1 byte(status)from register C6h
if ((Status & 0x20) ==1)
{
I2CReadBuffer(TVP5154A,0x94,&WSSData[0],3);
//if WSS/CGMS bit set,
// read the 3 WSS/CGMS bytes
// at WSS/CGMS data registers 94h–96h.
I2CWriteByte(TVP5154A,0xC6,0x20);
// clear WSS/CGMS available status bit
}
www.ti.com
Appendix C Example TVP5154A C Code
21
SLEA104 – July 2010
TVP5154A VBI Quick Start
Copyright © 2010, Texas Instruments Incorporated