Download Print this page

STC micro STC8A8K64D4 Series Reference Manual page 619

Advertisement

STC8A8K64D4 Series Manual
void Delay()
{
int i;
for (i=0; i<3000; i++)
{
_nop_();
_nop_();
_nop_();
_nop_();
}
}
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
P3M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
P5M1 = 0x00;
P_SW2 = 0x80;
I2CCFG = 0xe0;
I2CMSST = 0x00;
Start();
SendData(0xa0);
RecvACK();
SendData(0x00);
RecvACK();
SendData(0x00);
RecvACK();
SendData(0x12);
RecvACK();
SendData(0x78);
RecvACK();
Stop();
Delay();
Start();
SendData(0xa0);
RecvACK();
SendData(0x00);
RecvACK();
SendData(0x00);
RecvACK();
Start();
SendData(0xa1);
RecvACK();
//Enable I2C master mode
//Send start command
//Send device address + write command
//Send storage address high byte
//Send storage address low byte
//Write test data 1
//Write test data 2
//Send stop command
//Waiting for the device to write data
//Send start command
//Send device address + write command
//Send storage address high byte
//Send storage address low byte
//Send start command
//Send device address + read command
- 603 -

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