For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.
Yes matrix are far more able to deal with this then I am. I'm not sure why it's not working with hardware.
I have configured iocbf register and GIE and IOCIE within intcon register. It looks like IOCIF (IOC flag) is not being set with IOC. Yet C code looks correct to me. The flowchart I created just uses RB7 IOC. I had a look at IOCBF in a simulator and that is showing only bit7 as high which is what I expect. Also I have a headache now
It could be something I have not set correctly in 16F1939.fcd, so I will wait for guys at matrix to put me right.
Sorry can't help any further.
If you could create a flowchart that shows what you’re after, then I can make alterations to this attached flowchart.
Martin
when you commented above, this was what i was after (attachement) was wondering if there is any way to interrupt a long loop with out restarting the chip, my fcf obviously doesnt work because the laws of interrut says it will command "allow to=0 ...then turn of c2 pin" but then go right back to finishing the loop off...
Hi Brandon,
I have created a flowchart for you to try.
It is a crude version, and is only just for testing on your hardware, since Flowcode will not be able to simulate it.
I will look into doing an improved version.
The reason its crude, is because it goes against good design practice of keeping interrupts short as possible. If pause switch is activated C2 will be set to 0 and the status of PortC is stored in PORTC_VALUE. Then this flowchart deliberately stays within interrupt until switch A0 goes high. Then value of PORTC_VALUE is sent to portC2.
At this point people may be sucking though teeth, But I’m relying on the fact that whilst the loop is running within the interrupt, corruption should not occur.
This is because not using any delays, so macro does not exit hence GIE (Global interrupt Enable) is not set.
GIE goes to 0 when within an interrupt macro, this stops any interrupts from triggering at all. Therefore timer interrups can’t be triggered until ioc macro is exited.
Well at least that's my theroy. Please correct me, if you believe I'm wrong.
Hi Brandon
I have tested inturrupt loop1.fcf with real hardware. Just 2 comments to make.
1) You will need to set target speed back to 4MHz since I set it to 19.66MHz and forgot to change it back. I have since tested it with internal osc at 4MHz.
2) It appears to be 100% reliable. Looks like there is no rick of corruption, as explained in my previous post. I have got a scope connected to test waveform. Only thing I can’t confirm is if the pulse level carries on form where is was paused from. So if C2 was high when paused, not sure if carries on high until the end of the delay period when un-paused.
martin- thanks for the unorthodox loop interrupt file, it does stop the loop, but it doesnt do what i was hopeing to do, by resetting it back to the beginning of the loop, but thats ok though, because i wasnt sure if thats something that is commonly done, and i guess that it isnt a common nor recommented practice to interrupt a loop and commanding another loop without resetting with mclr, im learning all this as i go
brandonb wrote:martin- thanks for the unorthodox loop interrupt file, it does stop the loop, but it doesnt do what i was hopeing to do, by resetting it back to the beginning of the loop.
Sorry,
I thought for some reason after stopping loop, you wanted it to carry on from the point it was stopped from. That's the reason I placed a read port function in.
martin- does that make it easier or impossible due the the laws......ohh and check it out, i redid my flow bench controller using one chip only by implimenting interrupts (wonder how many times i wrote that word in these posts)