I’m doing a 16 row X 32 column matrix design & the display multiplexing is done in the ISR. At 1mS rate I’m getting into the ISR & update each row on every interrupt. For a frame it will take 1mS X 16 = 16mS.
I need to show moving patterns on the display & for that I need to generate delay routines (In the main code). For the time being I use delays using just delay loop codes.
The problem is, I see a very little flicker thing when the patterns moving. Do I need to generate delays using frames instead of just delay loops?
IRQ{ counter++;
}
main{
while(1){
if(counter>=timeUp){
timeUp=counter+20; wait 20mS
//do things here 50 times per second
{
if(counter>=timeUp2){
timeUp2=counter+50;
//do things here 20 times per second
}
}
}
Mike.
edit, in your case the while(1) would be replaced with a goto main at the end of your code.
Note, if you have count as 32 bit then it will stop working after 49 days due to wrap around.