Download Print this page

STC micro STC8A8K64D4 Series Reference Manual page 624

Advertisement

STC8A8K64D4 Series Manual
void SendData(char dat)
{
I2CTXD = dat;
I2CMSCR = 0x02;
Wait();
}
void RecvACK()
{
I2CMSCR = 0x03;
Wait();
}
char RecvData()
{
I2CMSCR = 0x04;
Wait();
return I2CRXD;
}
void SendACK()
{
I2CMSST = 0x00;
I2CMSCR = 0x05;
Wait();
}
void SendNAK()
{
I2CMSST = 0x01;
I2CMSCR = 0x05;
Wait();
}
void Stop()
{
I2CMSCR = 0x06;
Wait();
}
void Delay()
{
int i;
for (i=0; i<3000; i++)
{
_nop_();
_nop_();
_nop_();
_nop_();
}
}
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
//Write data to the data buffer
//Send a SEND command
//Send read ACK command
//Send RECV command
//Setup the ACK signal
//Send ACK command
//Setup the NAK signal
//Send ACK command
//Send STOP command
- 608 -

Advertisement

loading
Need help?

Need help?

Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin