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;} }