OM6277,598 NXP Semiconductors, OM6277,598 Datasheet - Page 46
![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
i2cslave.c
/**************************************************************
/*
/*
/*
/*
/*
/*
/**************************************************************
#include <Reg932.H>
#include "ua_exprt.h"
typedef unsigned char
typedef unsigned short
#define SLAVE_IDLE
#define SLAVE_BUSY
#define SLAVE_READY
#define SLAVE_TRX_ERROR
#define SLAVE_RCV_ERROR
#define GENERATE_STOP
#define RELEASE_BUS_ACK
#define RELEASE_BUS_NOACK
#define RELEASE_BUS_STA
static BYTE count;
char slaveBuf[3];
static BYTE size;
static BYTE slaveStatus;
void I2C_Interrupt(void) interrupt 6 using 1
{
switch(I2STAT)
{
Name of module:
Creation date:
Program language
case 0x60:
case 0x68:
case 0x70:
case 0x78:
case 0x80:
case 0x90:
case 0x88:
case 0x98:
case 0xA0:
case 0xB0:
case 0xA8:
case 0xB8:
case 0xC0:
case 0xC8:
break;
break;
break;
break;
break;
break;
(C) Copyright 2003 Philips Semiconductors B.V.
slaveStatus = SLAVE_BUSY;
count = 0;
if (size > 1)
else
slaveBuf[count++] = I2DAT;
if (count == size)
else
slaveStatus = SLAVE_RCV_ERROR;
I2CON = RELEASE_BUS_ACK;
slaveStatus = SLAVE_READY;
I2CON = RELEASE_BUS_ACK;
slaveStatus = SLAVE_BUSY;
count = 0;
I2DAT = slaveBuf[count++];
I2CON = RELEASE_BUS_STA;
slaveStatus = SLAVE_BUSY;
count = 0;
slaveStatus = SLAVE_TRX_ERROR;
I2CON = RELEASE_BUS_ACK;
I2CON = RELEASE_BUS_ACK;
I2CON = RELEASE_BUS_NOACK;
I2CON = RELEASE_BUS_ACK;
I2DAT = slaveBuf[count++];
I2CON = RELEASE_BUS_ACK;
I2CON = RELEASE_BUS_NOACK;
:
I2CSLAVE.C
BYTE;
WORD;
12 March 2003
C
0
1
2
3
4
0x54
0x44
0x40
0x64
// set STO, clear STA and SI
// clear STO,STA,SI and set AA (ack)
// clear STO, STA, SI and AA (noack)
// generate (rep)START, set STA
// bytes send/received of current message
// size of slave mode buffer
// status of the slave
// own SLA+W received, Ack returned
// Addressed as slave
// General call received, Ack returned
// Data will be received
// return ACK on first byte
// return NACK on first byte
// Data received, ACK returned
// read data
// return NACK on next byte
// return ACK on next byte
// received, NACK returned
// clr SI, set AA
// STOP or REP.START received, addressed as slave
// clr SI, set AA
// Arb. lost as MST, addressed as slave transmitter
// Transmit next data, restart
// MST mode if bus is free again
// Addressed as slave transmitter
// Data transmitted, ACK received
// Transmit next data
// clr SI, set AA
// Data transmitted, NOT ACK received
// clr SI, set AA
46