Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- uint16_t year,hour, min, sec, date, month;
- uart_init(9600);
- LPC_RTC->CCR = 0x00; //Disable RTC
- LPC_RTC->DOM = 17;
- LPC_RTC->MONTH = 02;
- LPC_RTC->YEAR = 2019;
- LPC_RTC->HOUR = 05;
- LPC_RTC->MIN = 50;
- LPC_RTC->SEC = 00;
- LPC_RTC->CCR = 0x01; //Enable RTC
- while (1)
- {
- /* Read Time */
- hour = LPC_RTC->HOUR;
- min = LPC_RTC->MIN;
- sec = LPC_RTC->SEC;
- /* Read Date */
- date = LPC_RTC->DOM;
- month = LPC_RTC->MONTH;
- year = LPC_RTC->YEAR;
- /* Display date and time on Serial window */
- uart_string("rnDate: ");
- uart_integer(date);
- uart_tx('-');
- uart_integer(month);
- uart_tx('-');
- uart_integer(year);
- uart_string("rnTime: ");
- uart_integer(hour);
- uart_tx(':');
- uart_integer(min);
- uart_tx(':');
- uart_integer(sec);
- uart_string("rnrn");
- }
- }
Add Comment
Please, Sign In to add comment