We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello! Following problem. I intend to use the RTC of the LPC932 to create a delay function. Since it is a 23 bit counter it can count larger values to push the delay function from 1ms to 840ms using a 10 MHz crystal. The code:
void delay (uint data cnt) { RTCCON &= 0xFE; // clear RTCF RTCCON &= 0x7E; // disable RTC cnt = cnt * 78; // minimum 1msec if (cnt > 255) { // load argument into RTCL and RTCH, both 8 bit RTCL = cnt - (cnt % 256); RTCH = cnt / 256;} else { RTCH = 0; RTCL = cnt;} RTCCON |= 1 ; // enable RTC while (!(RTCCON & 0x80)); // wait for counter to be 0, RTCF flag will tell RTCCON &= 0x7E; // disable RTC counter and clear RTCF flag;} }
There's always the chance that these registers can't be read out by the Emulator, of course. If the flag never gets reset, that can have a large number of possible reasons. You'll really have to check the assembly output code generated by Keil against the device's datasheet, very carefully, to make sure you're programming that RTC correctly.