A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Posts: 64
Joined: Mon Sep 28, 2015 8:19 pm
Has thanked: 14 times
Been thanked: 10 times


Postby DCW » Fri Jan 12, 2018 5:55 pm

hello... so maybe I am STUPID.. and cannot use the LOOP ICON.. correctly...!!
I have attached two PNG pictures.. of parts of my flowcode.. simply showing.. how I want to make a LOOP work.
So.. I have a variable called BEEP_COUNTER ... which for testing.. is setup as an INT (-32K to +32K) so that the simple number of 12000, or 24000 can be loaded into this variable. So the first PNG shows part of a MAIN loop, where BEEP_COUNTER is.. loaded with say 12000.
The second PNG shows the actual little loops which I made up, so as to BEEP a piezo buzzer connected to a suitable output.

SO when the program is compiled, and programmed into a suitable chip.. and this part of the routine is accessed.. the piezo buzzer... just carries on beeping continuously...

So.. one would expect that .. say a count of 12000 ... would mean I would get only one beep... (See the macro).. and then if I made BEEP_COUNTER to be 24000... I would then get 2 beeps... and 36000 would mean 3 beeps... OKAY.!!

If someone can fiddle with it... say you've got nothing to do... then you could enter the macro... and then make up a MAIN program and call the macro.. and if you solve the problem... WOW... would you mind telling me... please... how STUPID I am... and show me where I am STUPID... cause then maybe I might be able to learn something...
... or else... it's a bug... in the LOOP ICON... software inside flowcode... hmmm...
Many thanks - from DCW ....
2018-01-12 18_47_11-PIR - 16F688 -mk5-state-machine-Flowcode7.fcfx.png
2018-01-12 18_47_11-PIR - 16F688 -mk5-state-machine-Flowcode7.fcfx.png (87.8 KiB) Viewed 824 times
2018-01-12 18_44_08-PIR - 16F688 -mk5-state-machine-Flowcode7.fcfx _.png
2018-01-12 18_44_08-PIR - 16F688 -mk5-state-machine-Flowcode7.fcfx _.png (11.64 KiB) Viewed 824 times

User avatar
Matrix Staff
Posts: 14792
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4754 times
Been thanked: 4359 times


Postby Benj » Fri Jan 12, 2018 5:59 pm

Hi Spencer,

I think I have come across something similar and the code behind the loop is creating the count value as a byte and so is never going to count up to the correct value. With a fixed constant it’s easy for Flowcode to know the variable needs to be say a 16-bit value. I’ll see if it’s something we can improve for the next release.

One workaround is to change the loop type back to “Loop While” put your count variable in as the Expression and inside the loop decrement the count variable using a calculation icon.

loop.jpg (9.75 KiB) Viewed 822 times