Referencing Microchip PICs...
When reading through books about time delays, they always tend to make mention of counting instruction cycles for accuracy. For example, 4MHz oscillator executes an instruction in 1 microsecond assuming no prescaler, unless the instruction is a branch instruction in which case it would take 2 microseconds.
When using a delay instruction in C, as in the Microchip XC8 compiler using "__delay_ms(20)" for a 20 millisecond delay, will the compiler ensure that the delay is precisely 20 milliseconds, or is it one of those kinds of things where the compiler says "close enough" and if you want true accuracy, you should write the delay yourself in ASM?
When reading through books about time delays, they always tend to make mention of counting instruction cycles for accuracy. For example, 4MHz oscillator executes an instruction in 1 microsecond assuming no prescaler, unless the instruction is a branch instruction in which case it would take 2 microseconds.
When using a delay instruction in C, as in the Microchip XC8 compiler using "__delay_ms(20)" for a 20 millisecond delay, will the compiler ensure that the delay is precisely 20 milliseconds, or is it one of those kinds of things where the compiler says "close enough" and if you want true accuracy, you should write the delay yourself in ASM?