Hello Ian,
I'll give a more wide detail.
delay_ms(period); is a function which can be called from anywhere in the program, period is the value in ms, similarly delay_us(period) period is in us.
in this delay_ms function
1. I've a start function as shown above,
count=0;
LPC_SCT2->CTRL_U |= (1<<2); //stops timer
LPC_SCT2->MATCH[0].U=(SystemCoreClock/1000-1); //for 1 ms timer
LPC_SCT2->MATCHREL[0].U=(SystemCoreClock/1000-1); //for 1ms reload
LPC_SCT2->CTRL_U &= ~(1<<2); //start timer
2. and then a while loop : while(count<period);
3. and then a stop function.
so if I call a delay_us(period) function between, then the match value of that function changes.
Hope you understood.
Have a great day :smileyhappy: