multiple delays and loop with 12F609

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
ionize
Posts: 25
Joined: Fri Aug 05, 2011 8:01 pm
Has thanked: 29 times
Been thanked: 11 times
Contact:

multiple delays and loop with 12F609

Post by ionize »

Although I have built many devices over the years, I'm a newbie with little programming experience and I am trying to implement multiple delays using an interrupt and have an independent loop. Not sure if I'm headed in the right direction with this flowchart. The loop works as intended but the other delays don't seem to trigger off although they turn on. This is on a 12F609 but I have several 8 pin devices I could use. An 8 pin dip socket is what is already on the circuit board. Any suggestions?
I composed this flowchart with V5 but it says its a V4. I have both.
Thanks,
Scott
Attachments
multiple delays.fcf
(19.53 KiB) Downloaded 315 times

User avatar
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:

Re: multiple delays and loop with 12F609

Post by Benj »

Hi Scott,

Could the problem be that you are setting T_Cycle, T_Val and T_Count to 0 in the interrupt routine. Should these instead be set to 0 at the start of the program and then allowed to accumulate in the interrupt service routine?

User avatar
ionize
Posts: 25
Joined: Fri Aug 05, 2011 8:01 pm
Has thanked: 29 times
Been thanked: 11 times
Contact:

Re: multiple delays and loop with 12F609

Post by ionize »

Thanks BENJ for answering my call for help!
I tried your suggestion but no go. I also tried removing the loop and no go. I also removed the equalizing code at the start of the tick macro and still nothing yet. any more suggestions will greatly appreciated!

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: multiple delays and loop with 12F609

Post by medelec35 »

Hi Scott,
Take a read of this:
http://www.matrixmultimedia.com/mmforum ... 448#p32448
It may help?

If you would like to say what times you want to elapse and what you want hardware to do after each elapsed time, then I can help you to create a flowchart that works the way you have intended.

Martin
Martin

User avatar
ionize
Posts: 25
Joined: Fri Aug 05, 2011 8:01 pm
Has thanked: 29 times
Been thanked: 11 times
Contact:

Re: multiple delays and loop with 12F609

Post by ionize »

Thanks for your answer. I read the posts you referenced above while I was trying to come up with something and looking for some example code. What I need is a loop of say 10 minutes on and 10 off on port a bit 0 and 1, plus a delay that stays on of 1 hour on port a bit 2, 2 hours on port a bit 4 and 4 hours on port a bit 5 and if possible, reset at 5 hours. the port's bits would be turning on 2n3904 transistors. Hope that is clear. The loop section works great. (which I learned from you in other posts elsewhere) Thanks for your help and advice. I will keep playing with working code with interrupts from the example files until I understand whats going on better.
Scott

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: multiple delays and loop with 12F609

Post by medelec35 »

I forgot to ask if you are using a crystal or resonator for external osc or internal oscillator.
What is frequency of your oscillator?
For example I will create, I'm assuming your going to use internal oscillator at 8MHz.
This will give you more I/O pins.
Flowchart of course can be altered with different settings at anytime

I will post flowchart today

Martin
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: multiple delays and loop with 12F609

Post by medelec35 »

As promised as have created two flowcharts.

Both do the same thing, but V2 has more control e.g if push a switch then timer can be reset on any individual port bit.
E.g Press a switch to reset 4 hour timer.
This makes it a bit more complex and uses more rom.

V3 is a bit more simple and takes up less room on target device.

Since both flowcharts should do what you want them to do, creating more delays should be straight forward.
If there is anything you don't understand then just let me know.

Martin

Edit:
Bug with V2.
Corrected in V2b.
Attachments
multiple delays2b.fcf
Should work ok
(18.34 KiB) Downloaded 344 times
multiple delays3.fcf
(17.94 KiB) Downloaded 329 times
Martin

User avatar
ionize
Posts: 25
Joined: Fri Aug 05, 2011 8:01 pm
Has thanked: 29 times
Been thanked: 11 times
Contact:

Re: multiple delays and loop with 12F609

Post by ionize »

Martin, Werner is right- you are the Professor of Flowcode! You have blown me away with these charts. I've got to digest them and I'll get back to you, thanks

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: multiple delays and loop with 12F609

Post by medelec35 »

Hi Scott.
I do wish I knew enough to earn the title, but with other things in the pot stops me from learning in depth.
Also my memory is not good enough.

Thanks for the nice comments

Martin
Martin

Post Reply