Delay Timer in interupt macro

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
JamesH
Posts: 3
Joined: Mon Feb 13, 2012 5:53 pm
Has thanked: 1 time

Delay Timer in interupt macro

Post by JamesH »

Hi,

This is my first flowcode project so it is entirely possible i am trying to do something silly or it could be a bug I am not sure.

I am calling a macro by means of timed interrupt. If I use a delay timer anywhere in the called macro the programe will freeze when running in Hardware (ECIO)

The programme simulates in flowcode without issue. It only fails in hardware. If I remove the delay timer, everything works fine.

Is this a bug, or am I being daft?

Best Regards,

James.

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

Re: Delay Timer in interupt macro

Post by medelec35 »

Hi James,
You Can't place component delays, or any components that contains delays e.g LCD Components within interrupt macro.
It will cause all sorts of corruption issues

If you would like to post flowchart with the delay within the interrupt, I can alter it for you.
I tend to use the interrupt its self for multiple delays.
Eg assuming interrupt frequency is 180Hz:
count1 = count1 +1
count2 = count2 +1

If Count1 = 180 then count1 = 0: Seconds = seconds +1 // one second has elapsed

If Count2 = 90 then count 2 = 0: // Half a second has elapsed

Martin
Martin

JamesH
Posts: 3
Joined: Mon Feb 13, 2012 5:53 pm
Has thanked: 1 time

Re: Delay Timer in interupt macro

Post by JamesH »

Hi Martin

Thanks for the quick reply!

I had a suspicion that I was trying to do something silly, thanks for the info and your kind offer. Now I know the problem I will try to work around it in the way you suggested, I will learn more that way!

It’s interesting that I am using LCD calls in the macro and that doesn’t seem to cause a problem (although it does cause a complier warning), but if it is bad practice then I will remove them and handle it another way.

For future reference is it normal that the flowcode "simulator" will ignore issues like this?

Thanks again for your help!

Best Regards

James.

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

Re: Delay Timer in interupt macro

Post by medelec35 »

JamesH wrote: Thanks for the quick reply!

I had a suspicion that I was trying to do something silly, thanks for the info and your kind offer. Now I know the problem I will try to work around it in the way you suggested, I will learn more that way!
No problem and yes, very wise. I fully agree with you!
JamesH wrote: It’s interesting that I am using LCD calls in the macro and that doesn’t seem to cause a problem (although it does cause a complier warning), but if it is bad practice then I will remove them and handle it another way
Any reference to Stack issues should never be ignored.
corruption could occur straight away of could only occur under certain conditions, so may happily work for a while first
JamesH wrote: For future reference is it normal that the flowcode "simulator" will ignore issues like this?
Yes since Flowcode simulator does ignore issues like this and it also ignores C code and program size e.g too big to fit in target device.
I find its a good idea to compile to hex every so often. Then any corruption, C errors (if using a C code block), file too big for target etc will be flagged up.
Although I must say FC5 simulator is much better then Flowcode4. Loads of work has gone into improving simulator.

The only messages you can totally ignore is any warning directly under:
'Warning unreferenced functions removed:'


Martin
Martin

JamesH
Posts: 3
Joined: Mon Feb 13, 2012 5:53 pm
Has thanked: 1 time

Re: Delay Timer in interupt macro

Post by JamesH »

Hi Martin,

I just wanted to let you know I have implemented the timers in the way you suggested. Its a clever solution and works a treat!

Thanks again for your help.

Best Regards,

James.

Post Reply