Call a macro for time delays

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Call a macro for time delays

Post by JLeith »

Hello all
I have come it pickle with my Master pitch count. Running into to much code.

I cleaned up old code that was disabled and deleted 2 old macro.

Went from ( -5 ) to (-2), Getting close

I had a old thought if I had several Delays with 10ms I could call say Macro10 that would have the 10ms delay.
Will calling a Macro for Delays save on word count?

Here is my Message
ROM available:16384 words, used:17043 words (102.0%), free:-659 words (-2.0%)

Is there a way in flowcode 6 to see the word count before I send to chip?

John

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: Call a macro for time delays

Post by Benj »

Hi John,

Maybe try making a new constant, assigning the value 10 and then referencing the constant. If this fails then it's worth a go.

The compile to hex option allows you to compile without programming.

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: Call a macro for time delays

Post by JLeith »

Hello Benj

Not 100% sure how to use the Constant
Constant.png
(8.03 KiB) Downloaded 1925 times
I can create something that resembles a 2 second timer. But it doesn't look right.

And how to I call it in a 2 second timer ?

In the images the "Macro2s" was a call for 2 second timer.

I have attached my Flowcode 6 design maybe you can spot a cleanup or how to work with Constants. Google doesn't give me much knowledge.

John
Attachments
Pitcher Master June 19.fcfx
(337.62 KiB) Downloaded 190 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: Call a macro for time delays

Post by Benj »

Hi John,

If you have code like this.

do this
delay_ms(10)
do that
delay_ms(10)
do the other
delay_ms(10)

then you can create a constant with the value 10 e.g. myconst and then the code would look like this.

do this
delay_ms(myconst)
do that
delay_ms(myconst)
do the other
delay_ms(myconst)

I'll have a scan through your program and see if I can spot anything for you.

Some of the variables have initialiser values and then are initialised again in the START macro. Pitch, AlarmH and StopHM to name a few.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Call a macro for time delays

Post by LeighM »

Hi John,
You also have some repeating code that could be replaced with macros,
in particular, in the Keypad macro you have a lot of strings to print on the display that are copies,
maybe you could create PrintHomeMenu and PrintAwayMenu macros.
In fact there is only one string difference between these two, so maybe have a PrintMenu macro that has a menu selection parameter,
then within the macro if selection is 0 print home, or if 1 print away.
I also noticed that in the menu print you have a string print followed by a screen clear.

Post Reply