Compiler errors

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
Xavier
Posts: 99
Joined: Sat Mar 17, 2012 11:26 pm
Location: South Africa
Has thanked: 5 times
Been thanked: 3 times

Compiler errors

Post by Xavier »

Hi Guys

When I compile to hex I get a lot of errors and I'm beet if I know why, this is getting quite frustrating as I don't get this many errors and when I do I normally can get rid of them. I sometimes wonder if I should not just go back to analog, more components but less problems.

All the best
Xavier
Attachments
PI_Detector_3.fcf
(34.26 KiB) Downloaded 289 times

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: Compiler errors

Post by medelec35 »

Hi Xavier,
The problem with your flowchart is all to do with your timer interrupt!

With a timer interrupt must be able to exit normally at the bottom of the macro, and be as short as possible.
E.g Don't use loops that are long or repeat for ever and don;t have a call macro to leave interrupt.

If you place the same component (or a function like (MOD)in the interrupt as you have in any other macro then you will get a serious corruption warning.
E.g If you have an LCD component in both Main and your timer interrupt, then you will get the serious corruption warning.

It looks like your using your timer interrupt as your main program, since you have within a run forever loop.
Best to leave interrupts for port inputs/outputs, calculations etc.
Then use other Macros for LCD updates etc.

So if you give that a go and re-post your flowchart, I can help you further.

Martin
Martin

Xavier
Posts: 99
Joined: Sat Mar 17, 2012 11:26 pm
Location: South Africa
Has thanked: 5 times
Been thanked: 3 times

Re: Compiler errors

Post by Xavier »

Hi Martin

So if I understand I should return to Main after each time my program has run through it's timer's and after each timer call a macro to do the LCD update? I was under the impression that one cannot call a macro from within a macro so if I'm right I will have to do the macro call from within main to do the LCD update.

Thanks for the help Martin I'll get back to you once I have changed things round a bit (quite a lot)

All the best
Xavier

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: Compiler errors

Post by medelec35 »

Xavier wrote:So if I understand I should return to Main after each time my program has run through it's timer's and after each timer call a macro to do the LCD update? I
Yes That is indeed the case. Just allow the timer macro to exit out the bottom of the interrupt macro.
What I do is place a variable called update within my interrupt macro.
Then in Main I have a Decision branch:
If update then Update = 0 : Call Update LCD Macro
Xavier wrote: I was under the impression that one cannot call a macro from within a macro
Well you can call a macro form another macro so long as

1. Your not calling a macro from an interrupt macro
2, The second macro is allowed to exit at the bottom of the macro.
3. Very important: Number of stacks are not exceeded (You will get a warning about this during compiling. Just remember its not just going into macros that will cause stacks to increase, stack will increase with going to to each component, but will decrease again when back out of the component etc), then you can call even more macros from with in macros, but never call any of the macros that have got you into your current macro if you know what I mean?

E.g
Call LCD update Macro
Then within LCD update Macro you call a Switch detect Macro.
If within the Switch detect macro you again call LCD update Macro, that is where program will fail.
Stack corruption will be on the cards.

When you do compile, it is always advisable to look out for stack corruption warnings.
If any are shown, then you will need to modify flowchart until no more corruption warnings.



Since its not an interrupt macro then you can have LCD routines in both macros, the not the came component only applies to interrupt macros.
Martin

Xavier
Posts: 99
Joined: Sat Mar 17, 2012 11:26 pm
Location: South Africa
Has thanked: 5 times
Been thanked: 3 times

Re: Compiler errors

Post by Xavier »

Hi martin

Thanks for clearing that up for me, things are starting to make a lot more scene. I have changed my flow chart and am getting no more errors but I'm not sure if I went about it in the right way. LED2 flashes when you start the simulation, I added that to check my hardware, found that the PCB is faulty, it has a short in it somewhere so will do a rebuild at the end of the month.

All the best to you
Xavier
Attachments
PI_Detector_3.1 (1).fcf
(39.26 KiB) Downloaded 289 times

Post Reply