EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 612

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 596 -
}
void SendData(char dat)
{
I2CTXD = dat; //Write data to the data buffer
busy = 1;
I2CMSCR = 0x82; //Send a SEND command
while (busy);
}
void RecvACK()
{
busy = 1;
I2CMSCR = 0x83; //Send read ACK command
while (busy);
}
char RecvData()
{
busy = 1;
I2CMSCR = 0x84; //Send RECV command
while (busy);
return I2CRXD;
}
void SendACK()
{
I2CMSST = 0x00; //Setup the ACK signal
busy = 1;
I2CMSCR = 0x85; //Send ACK command
while (busy);
}
void SendNAK()
{
I2CMSST = 0x01; //Setup the NAK signal
busy = 1;
I2CMSCR = 0x85; //Send ACK command
while (busy);
}
void Stop()
{
busy = 1;
I2CMSCR = 0x86; //Send STOP command
while (busy);
}
void Delay()
{
int i;
for (i=0; i<3000; i++)
{
_nop_();
_nop_();
_nop_();
_nop_();

Table of Contents

Related product manuals