OM6277,598 NXP Semiconductors, OM6277,598 Datasheet - Page 24
![DEMO BOARD FOR PCA9564](/photos/9/8/90802/om6277_sml.jpg)
OM6277,598
Manufacturer Part Number
OM6277,598
Description
DEMO BOARD FOR PCA9564
Manufacturer
NXP Semiconductors
Datasheet
1.OM6277598.pdf
(52 pages)
Specifications of OM6277,598
Main Purpose
Interface, I2C Controller
Embedded
Yes, MCU, 8-Bit
Utilized Ic / Part
PCA9564
Primary Attributes
I2C Bus Controller, 1 8-Bit GPIO, 1 8-Bit LED Dimmer
Secondary Attributes
8 Momentary Switches, 23 LEDs
Lead Free Status / RoHS Status
Not applicable / Not applicable
Other names
568-4001
935283226598
935283226598
extern unsigned char CRX;
extern idata BYTE
extern idata BYTE
extern idata BYTE
extern idata BYTE
extern idata I2C_MESSAGE Message1;
extern idata I2C_MESSAGE Message2;
extern idata I2C_MESSAGE Message3;
extern idata I2C_MESSAGE Message4;
//****************************************************************************
// I2C Address Search Routine
// Make the search between min and max
// Return the I2C Address and set the Search_Successful bit
// to 1 when search has been successful
//****************************************************************************
unsigned char Search_Routine(unsigned char min, unsigned char max)
{
unsigned char I2C_Address_Write;
unsigned char I2C_Address_Read;
unsigned char Address_Sent_Status;
unsigned char Command_Sent_Status;
unsigned char Counter_I2C_Address_Write = min;
unsigned char Counter_I2C_Address_Read = min+1;
int i;
Search_Successful = 0;
while (Counter_I2C_Address_Write != max & Search_Successful == 0)
{
{
Counter_I2C_Address_Write++;
Counter_I2C_Address_Write++;
Counter_I2C_Address_Read++;
Counter_I2C_Address_Read++;
I2C_Address_Write = Counter_I2C_Address_Write;
I2C_Address_Read = Counter_I2C_Address_Read;
PCA9564_Write(I2CCON,0xE0 | CRX);
for (i=0; i < 200;i++);
PCA9564_Write(I2CDAT,I2C_Address_Write);
for (i=0; i < 200;i++);
PCA9564_Write(I2CCON,0xC0 | CRX);
for (i=0; i < 200;i++);
Address_Sent_Status = PCA9564_Read(I2CSTA);
switch (Address_Sent_Status)
case 0x18 : //Ack received
PCA9564_Write(I2CDAT,0xFF);
for (i=0; i < 200;i++);
PCA9564_Write(I2CCON,0xC0 | CRX);
for (i=0; i < 200;i++);
Command_Sent_Status =
PCA9564_Write(I2CCON,0xD0 | CRX);
for (i=0; i < 200;i++);
if (Command_Sent_Status == 0x28)
{
}
PCA9564_Write(I2CCON,0xD0 | CRX);
if (Data_Received == I2C_Address_Write)
{
PCA9564_Write(I2CCON,0xE0 | CRX);
for (i=0; i < 200;i++);
Command_Sent_Status =
if (Command_Sent_Status == 0x08)
{
}
Search_Successful = 1;
Buffer1[32];
Buffer2[32];
Buffer3[16];
Buffer4[16];
PCA9564_Write(I2CDAT,I2C_Address_Read);
for (i=0; i < 200;i++);
PCA9564_Write(I2CCON,0xC0 | CRX);
for (i=0; i < 200;i++);
Command_Sent_Status =
if (Command_Sent_Status == 0x40)
{
}
PCA9564_Write(I2CCON,0x40 | CRX);
for (i=0; i < 200;i++);
Data_Received = PCA9564_Read(I2CDAT);
PCA9564_Read(I2CSTA);
PCA9564_Read(I2CSTA);
PCA9564_Read(I2CSTA);
24
// Increment I2C Address Write (+2)
// Increment I2C Address Read (+2)
// 1110 0xxx -> generate Start
// Send Address Byte + W
// I2CCON=11000xxx
// Read status Register
// send Command byte (0xFF)
// I2CCON=11000xxx
// send Stop
// Command byte has been ack'ed
// 1110 0xxx -> generate Start
// Start = OK
// send Address Byte + R
// I2CCON=11000xxx
// Addr + R = OK
// Read Data and NACK
// send Stop
// Search successful if Read Data = Address
// Search routine starts