|
![]() Oscillators/PCA/Timers/SMBus/UART/SPI
![]() More than 1 sec precision from RTC. msecs are in need.
|
| next newest topic | next oldest topic |
| Author | Topic: More than 1 sec precision from RTC. msecs are in need. |
|
AlexeiP New Member |
I use (simplified here) code for capturing RTC ticks. I need all CAPRUTEn register values. But fail to get it (for unknown reasons). Seconds-years read OK, but I need msecs. Is it possible (and how) to get what i need. RTC0ADR = 0x5; // CAPTURE5 Target the capture registers RTC0ADR = 0x4; // CAPTURE4 Target the capture registers RTC0ADR = 0x3; // CAPTURE3 Target the capture registers RTC0ADR = 0x2; // CAPTURE2 Target the capture registers RTC0ADR = 0x1; // CAPTURE1 Target the capture registers RTC0ADR = 0x0; // CAPTURE0 Target the capture registers IP: Logged |
|
Scotty Member |
Hi AlexeiP, this is too little information. Which device are you using? How do you initialize RTC? ... Regards, Scotty IP: Logged |
|
AlexeiP New Member |
I use c8051F410.Initialization is IMHO OK. I read seconds. But fail to get proper data from CAPTURE0 and CAPTURE1. Thank you for replying.Please, advice for any type of MCU. Any general information on getting all 47 bits of RTC current value. IP: Logged |
|
AlexeiP New Member |
My read initialization in reply for your request Scotty. LONG RTC_Read(void){ RTC0DAT = 0xD9; // Initiate the transfer to the CAPTUREn while ((RTC0ADR & 0x80) == 0x80); // Poll on the BUSY bit // Poll on the RTC0CAP bit until it indicates the transfer to the CAPTUREn IP: Logged |
|
Scotty Member |
Hi AlexeiP, I use c8051F410 Initialization is IMHO OK Please, advice for any type of MCU. I read seconds. But fail to get proper data from CAPTURE0 and CAPTURE1.
Note that according to datasheet setting the register adresses in RTC0ADR is not neccessary since the addresses will increment automatically when accessing the capture registers. Regards, Scotty [This message has been edited by Scotty (edited August 15, 2010).] [This message has been edited by Scotty (edited August 15, 2010).] IP: Logged |
|
AlexeiP New Member |
Topic is closed. CAPTURE0 and CAPTURE1 read OK. 30.51*((CAPTURE0+CAPTURE1<<8)>>1) provides a needed range of a fraction of a second. IP: Logged |
|
AlexeiP New Member |
Thank you Scotty a lot. Sure, I'm using increment addressing. My question was in a lot simplified form. A crusial issue was to set a bit to transmit RTC ticks to CAPTUREn registers for futher read. Another problem for me was how to deal with CAPTURE0/1 values. All this is solved now. Thank you. IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
Have you seen our MCU Knowledge Base?