RTC 1338 Nboard
Dependencies: mbed
main.cpp
- Committer:
- gr66
- Date:
- 2017-02-27
- Revision:
- 0:ba08f73d8087
File content as of revision 0:ba08f73d8087:
#include "IHM.h" IHM ihm; //clase IHM I2C i2c(PB_7,PB_6); Serial pc(USBTX, USBRX); // I/O terminal PC int main() { ihm.LCD_clear(); ihm.LCD_gotoxy(0,1); ihm.LCD_printf("HTC DS 1338 "); wait(2); ihm.LCD_clear(); int address = 0xd0; // init RTC char data[8]= {0x00,0x30,0x59,0x23,0x1,0x31,0x12,0x16}; // reg de départ/ss/mm/hh/js/jj/mm/aa data[0]=0x00; i2c.write(address, data, 8,false); while(1) { // lecture RTC data[0]=0; wait(1); i2c.write(address, data, 1,false); i2c.read(address, data, 7,false); ihm.LCD_gotoxy(0,0); ihm.LCD_printf("%02x:%02x:%02x",data[2],data[1],data[0]); ihm.LCD_gotoxy(1,0); ihm.LCD_printf("%02x/%02x/%02x",data[4],data[5],data[6]); } }