I need to implement an external interrupt service routine that has 60 second delay in it. The ISR will calibrate a robotic device in this time interval. I know that generally using long delays in interrupts is not a good practice. Also I noticed that when I use a long delay in ISR the compiler gives a warning(I have no idea about it)
How can I implement a successful ISR in CCS,with a 60 second delay?
Any help will be welcomed.
Code:
#int_ext
void compass_calibration(void);
void calibration_isr(){
compass_calibration();
}
Code:
void compass_calibration(){
output_low(pin_b1);
compass_sync();
spi_write(0xAA); //slm
spi_write(0x06); //setconfig
spi_write(0x05); //cpid - period
spi_write(0x04); //period data uint8
spi_write(0x00); //terminator
output_high(pin_b1);
Use one interrupt to start another.
The external interrupt starts a timer interrupt that say increments a second counter. The main routine loops waiting for the seconds to reach 60.
It then can reset the seconds counter and disable the timer so a repeat of the whole sequence can occur. The two interrupts free the main routine from being blocked by the delay_ms etc.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum