Interrupt speed
Posted: Tue May 05, 2020 11:48 am
How do interrupts work at the nanosecond level in PICs and Flowcode? Say I have a 8 bit all port interrupt. When any of the 8 bits changes state it triggers the interrupt “instantly”. But in practice I assume that it works at processor clock speed rather than instantly so needs say 1 to 4 clocks to generate the interrupt. Thus if say the clock period is 20ns on a 50MHz PIC and I have a data change lasting only 5nS will that trigger the interrupt?
I ask because I want to detect changes on a fast multi bit signal. and store the results. Say it changes from 1111 to 1100. Due to rise and fall times and propagation delays there is a very short period when it may have an indeterminate value, like 1110 or 1101, before changing solidly to 1100. Say on one clock cycle it is 1111, on the next 1101 and the third 1100. Will the interrupt thus trigger twice?
This is rather like debouncing a switch input. Do interrupts effectively debounce and over what period of time? I’d follow the interrupt with “read the port” command by which time the data is hopefully solid. But it will not give the right answer if it rapidly triggers twice or more so I end up storing more than one result in quick succession.
I ask because I want to detect changes on a fast multi bit signal. and store the results. Say it changes from 1111 to 1100. Due to rise and fall times and propagation delays there is a very short period when it may have an indeterminate value, like 1110 or 1101, before changing solidly to 1100. Say on one clock cycle it is 1111, on the next 1101 and the third 1100. Will the interrupt thus trigger twice?
This is rather like debouncing a switch input. Do interrupts effectively debounce and over what period of time? I’d follow the interrupt with “read the port” command by which time the data is hopefully solid. But it will not give the right answer if it rapidly triggers twice or more so I end up storing more than one result in quick succession.