Hi oooky,
The 1st flowchart I posted is suppose to work but it does not because of a bug in Flowcode V3 as explained.
One important thing I should have mentioned:
With 12F series the IOC will only simulate with Flowcode V5.
Since FC3 support is stopping soon (start of June) FC5 is a definitely a well worth investment.
So with Flowcode V3 and V4 if you activate the switch, nothing will happen. That's only a simulation fault.
I can guarantee 100% it does work with a real 12F615, as I have got the hardware set up on my Matrix protostation.
So If yours is not working you will need to look at the programming and hardware setup.
It looks like you have posted some images, but they are not showing up.
Just click the 'Upload attachment' tab, Click 'Choose File' browse to the image, click 'Open' then click 'Add the file'
The second flowchart I posted overcomes the bug.
oookey wrote:
But why is the “interrupt – enable port change” out of the while loop instead the “decision of change” is within the loop? Wouldn’t the chip work faster if only the “interrupt-enable port change” is within the while-loop, remove the “decision of change” routine out?
No, interrupts are not used that way.
The interrupt is enabled only once. (unless you disable interrupt, then you will have to re-enable it!)
So the interrupts are only enabled at the beginning of the flowchart before the main loop.
Each time A1 changes state (either low to high, or high to low) then the interrupt macro is accessed.
There is a decision branch within the interrupt to ignore if switch has gone from high to low, otherwise count will increment twice each time switch is pressed then released.
The reason the decision branch is within main loop is because you can't place a PWM macro component in the interrupt and also within any other macro, including Main.
If you are not going to add any more PWM components then you can change your flowchart to this:
It will still work on hardware.
oookey wrote:may be I'm stretching too far for FC3 using this chip.
No it's not stretching FC3 at all!
However If your creating any flowcharts that involve IOC then you must use a C block with ioc=x;
Where x is the value for required GP pin.
Or if you find it eaiser use binary.
So for GP2 use:
For GP5 and GP2 for example use:
Martin