My code has long delays like 5 seconds set. If a button on a Port B interrupt is pressed in the middle of one of these long delays it is not read in Flowcode's simulation. Have to wait till end of delay to press the button.
Is this also true of the real hardware or is it just the way Flowcode simulates it?
Could split delay down into 100 shorter delays if needed e.g. a loop running 100 short delays.
Long delays and interrupts
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello
The hardware will not react like this. We are working on making Flowcode simulate more like the hardware and we are getting close.
However the interrupt on the PICmicro will occur the next program cycle after the interrupt has been triggered. The PIC will then complete the interrupt service routine and then go back to where it was in the delay.
For a set amount of smalller delays you could do the following.
count = 0
While count < 100
{
short delay
count = count + 1
}
The hardware will not react like this. We are working on making Flowcode simulate more like the hardware and we are getting close.
However the interrupt on the PICmicro will occur the next program cycle after the interrupt has been triggered. The PIC will then complete the interrupt service routine and then go back to where it was in the delay.
For a set amount of smalller delays you could do the following.
count = 0
While count < 100
{
short delay
count = count + 1
}
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Just to say that I've also exprienced the same type of scenairo mentioned in the previous comment by echase with regard to interupt simulation, and as Benj mentioned I have indeed found that the PIC hardware reacts with what appears to be an almost instant effect on the trigger of an interupt rather than how flowcode reacts in simulation, but its good to hear the guys at matrix are working to refine a simulation solution which is great news!