Page 1 of 1

Interrupt on startup

Posted: Tue Dec 15, 2009 4:47 pm
by BedfordCollege
I have written a flowcode program in Flowcode for an 18F72 PIC.
I am testing it using the eBlocks system - so I assume all pins are terminated correctly and not floating.
Port A is not used, Port B is inputs, Port C is outputs.

It works a treat in simulation, with the RBchange interrupt working perfectly.
However when I compile it to chip, it goes immediately into interrupt.

The INT Enable flowcode block is the first entry after 'Begin'.

If I write a dummy loop sitting waiting for all the switches to be zero before enabling the interrupt it seems to fix it - however this shouldn't be necessary should it????

Re: Interrupt on startup

Posted: Tue Dec 15, 2009 5:51 pm
by Benj
Hello

What if you add an input icon to the start of your program before the interrupt enable to read the contents of portb into a dummy variable? Hopefully this should get rid of the false interrupt problem.

If this fails then you could create a flag in your main program that gets set on startup. The interrupt then checks the flag and if it is set then it clears it and exits the interrupt. Then if the flag is already clear then the interrupt happens as normal.