0x9A, 9=1001, A=1010, 3bit 101, 7bit= 0b1001101
0x96, 9=1001, 6=0110, 3bit 011, 7bit=0b1001011
we can modify the code for multiple TC74 as below:
unsigned char s1[10], s2[10];
uint8_t readValue[1], readValue2[1];
I2C_MESSAGE_STATUS I2C_status;
OpenXLCD(FOUR_BIT & LINES_5X7);
WriteCmdXLCD(DON&CURSOR_OFF&BLINK_OFF);
while (1)
{
// Add your application code
I2C_MasterWrite( 0, 1, 0b1001101, &I2C_status);
while (I2C_MESSAGE_PENDING == I2C_status);
I2C_MasterRead( &readValue, 1, 0b1001101, &I2C_status);
while (I2C_MESSAGE_PENDING == I2C_status );
sprintf(s1, "%02d", readValue[0]);
I2C_MasterWrite( 0, 1, 0b1001011, &I2C_status);
while (I2C_MESSAGE_PENDING == I2C_status);
I2C_MasterRead( &readValue2, 1, 0b1001011, &I2C_status);
while (I2C_MESSAGE_PENDING == I2C_status );
sprintf(s2, "%02d", readValue2[0]);
while(BusyXLCD());
SetDDRamAddr(0x01); // clear LCD
putrsXLCD("Temp1=");putrsXLCD(s1);
SetDDRamAddr(0x40); // goto second line
while(BusyXLCD());
putrsXLCD("Temp2=");putrsXLCD(s2);
__delay_ms(1000);
}
}
Hiç yorum yok:
Yorum Gönder