Count past 10

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

Count past 10

Post by JLeith »

Hello all
Just spotted a glitch in my Halloween counter and I was hoping someone has a fix before I dive in and mess it up

I have 5 buttons
Button 1 counts by 1
Button 2 counts by 2
Button 3 counts by 3
Button 4 counts by 4
Button 5 counts by 5

The glitch is when I count Button 5 then button 4 my Quad displays 1b == 11
My flow in Home Swithes catches when I only use Button 1 it will display 11
Just can't figure out a flow to catch 11 - 19 and 21- 29

My glitch is if I count past 10 using combinations of any buttons but 1 my Quad doesn't display correctly.

John
Attachments
Halloween Spooky counter 2017.fcfx
(57.43 KiB) Downloaded 291 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: Count past 10

Post by medelec35 »

Hi John ,
Looks like the wrong values are being sent to the 7seg displays!
Each display has to have a value from 0 to 9
So to show 10 you will need to send a 1 to first display then send the 0 to the second display.
It looks like you are sending numbers greater than 9 to a single display:
Seg Values.png
(53.04 KiB) Downloaded 3734 times

Code: Select all

since 12 = 0x0C
That's why display shows a letter C instead of a single decimal number.
If you have a value e.g

Code: Select all

Count  = 1234
You can separate each digit for uusing on Quad 7seg display by using the MOD function.
I.e

Code: Select all

Thousands = Count / 1000 MOD 10
Hundereds = Count/100 MOD 10
Tens = Count / 10 MOD 10
Units = Count MOD 10
If you need further help then let me know

Martin
Martin

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

Re: Count past 10

Post by JLeith »

Hi Martin
I changed my program to reflect the "MOD amd / 10

I can get to 100 and the "Count counts.....

The odd is I can't get the "Digit_Tens" to count past 100. I did a reset to 0 when Tens reached 10 so it would display 100

Just cant get it running

Math ( Digit_Ten = Count / 10 ) "110 / 10 = 11"

Digit_Hundreds does advance to 2 \.....9

John
Attachments
Halloween Spooky counter 2017.fcfx
(62.33 KiB) Downloaded 290 times
TEN count.jpg
TEN count.jpg (83.51 KiB) Viewed 5823 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: Count past 10

Post by medelec35 »

Hi John,
Some of the calculations were wrong.
Try the attached flowchart.

Martin
Attachments
Halloween Spooky counter 2017 10_1.fcfx
(63.79 KiB) Downloaded 315 times
Martin

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

Re: Count past 10

Post by JLeith »

Thank you

I tried the "Digit_Tens = Count / 10 MOD 10"

I had it backwards " "Digit_Tens =MOD 10 Count / 10 " and it won't work.

Also I didn't disable the all the 'Add_Home" I thought the Switch main would work.

Fantastic new info the 'MOD" function

John

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: Count past 10

Post by medelec35 »

Hi John,
You all sorted now?
Martin

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

Re: Count past 10

Post by JLeith »

Hello Martin

The new code works 100% in Flowcode. Thank you

One major glitch is in live performace.

The Quad Update is Updating to often and the digits are flashing

I was using the D7 as the "Dot" on the Quad as a indicator that it was running

It is flashing like crazy so I disabled it.

Now the Digits are flashing at a high rate. Not a clean display.

I suspect the Interrup is updating the Quad to often. I guess there is no way to only update when a Button is pressed
I follow that the program runs thru Main loop then off to Home switches looking for a button press. I don't know how the Interrup triggers and can that be controlled.

Opps I just noticed that the fuzzy display is when it was sitting at "00"

Once I was running thru the display was a lot better.

John

Post Reply