@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* the function name: void At24c02Write (unsigned char addr, unsigned char dat)
* functions: 24 of our fleet to an address into a data
* input: no
No
* output:* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Void AT24C02Write (unsigned char addr, unsigned char dat)
{
I2cStart ();
Xa0 I2cSendByte (0);//send a device address
I2cSendByte (addr);//sent to write memory address
I2cSendByte (dat);//send data
I2cStop ();
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* the function name: unsigned char At24c02Read (unsigned char addr)
* function function: read 24 our fleet of an address of a data
* input: no
No
* output:* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Unsigned char At24C02Read (uchar addr, uchar num)
{
I2cStart ();
Xa0 I2cSendByte (0);//send a device address
I2cSendByte (addr);//sent to read address
I2cStart ();
I2cSendByte xa1 (0);//send reading device address
Num=I2cReadByte ();//read the data
I2cStop ();
Return num.
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
Void Start_display ()
{
Error: if (AT24C02Read (255).=18)
{
AT24C02Write (0, Set_temp_H);
AT24C02Write (2, Set_temp_L);
AT24C02Write (255);
}
The else
{
Set_temp_H=AT24C02Read (0);
Set_temp_L=AT24C02Read (2);
}
LCD_Dispstring (2, 0, "Temp:");
LCD_Dispstring (0, 1, "Max:");
LCD_Dispstring (9, 1, "Min:");
}
CodePudding user response:
AT24C02Read defined as two parameters, and use it every time it is a parameterCodePudding user response:
That there should be how to change ah, thank youCodePudding user response: