When does an Interrupt Interrupt?

retepsnikrep

Senior Member
Take the following line of code, which is in a repeating loop of other simple code until an interrupt is recieved.

CellV = RefVADC *25 / RefADC * 100 / 25

Will an Interrupt interrupt it, or will it complete the entrie line before interrupting? :confused:

I understand the general principle about interrupts being actioned after every command.

I wan't to use an interrupt, but I dont want the above calculation broken by the program jumping out of the line, as after the interrupt is generated my code sends the result of this to another program.

I know preserving the previous result from the last loop works, so the routine sends the earlier result to avoid potential errors but do I need to do this?
 

hippy

Technical Support
Staff member
An interrupt will only occur when the current statement is finished. In this case the calculation will complete before an interrupt will happen ( although it can also happen before it starts the calculation so take care that data an Interrupt uses has been calculated before allowing the first interupt ).
 

westaust55

Moderator
It works as Hippy states.

The PICAXE manual 2 makes this clear:
The inputs port is checked between execution of each command line in the program, between each
note of a tune command, and continuously during any pause command.
That is, not during the processing of each command line other than for a tune or pause command.
 
Last edited:
Top