Guest User

Untitled

a guest
Feb 18th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. int main()
  2. {
  3. uint16_t year,hour, min, sec, date, month;
  4.  
  5. uart_init(9600);
  6.  
  7.  
  8. LPC_RTC->CCR = 0x00; //Disable RTC
  9.  
  10.  
  11. LPC_RTC->DOM = 17;
  12. LPC_RTC->MONTH = 02;
  13. LPC_RTC->YEAR = 2019;
  14.  
  15.  
  16. LPC_RTC->HOUR = 05;
  17. LPC_RTC->MIN = 50;
  18. LPC_RTC->SEC = 00;
  19.  
  20. LPC_RTC->CCR = 0x01; //Enable RTC
  21.  
  22.  
  23. while (1)
  24. {
  25. /* Read Time */
  26. hour = LPC_RTC->HOUR;
  27. min = LPC_RTC->MIN;
  28. sec = LPC_RTC->SEC;
  29.  
  30. /* Read Date */
  31. date = LPC_RTC->DOM;
  32. month = LPC_RTC->MONTH;
  33. year = LPC_RTC->YEAR;
  34.  
  35. /* Display date and time on Serial window */
  36.  
  37. uart_string("rnDate: ");
  38. uart_integer(date);
  39. uart_tx('-');
  40. uart_integer(month);
  41. uart_tx('-');
  42. uart_integer(year);
  43.  
  44. uart_string("rnTime: ");
  45. uart_integer(hour);
  46. uart_tx(':');
  47. uart_integer(min);
  48. uart_tx(':');
  49. uart_integer(sec);
  50. uart_string("rnrn");
  51.  
  52. }
  53. }
Add Comment
Please, Sign In to add comment