7 Segment Display control

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
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

7 Segment Display control

Post by JLeith »

Hello All,

I have finally found my way around Flowcode 5.

Now I have hit a glitch using the 7 Segment Displays. I'm using them as a Display to simulate my end result to control the segments in a display.

In this example I have two displays with labels LedSeg4 & LegSeg5. Seg 4 I have set the common to Port A 1 and Seg 3 to common Port A 4.

Now in my program I send display to the SEG4 to count to 9 and step 10 to "0" call a routine to advance Seg 3 to 1 giving me "10" and then go back to Seg 4 and step thur to 9 and the back to Seg 3 to "2" with a max score of "29"

Oddly once Seg 4 display 1 the mess begins.
Segment Display.jpg
Segment Display.jpg (86.21 KiB) Viewed 5823 times
I would think if I send the Display to led Segment 3 why is Segment 4 not staying as 0
Segment Display.jpg
Segment Display.jpg (86.21 KiB) Viewed 5823 times
Maybe I need to address the Port A but not sure how. When I set Port A pin 1 low the display blanks so that wont work.

Your help would be appreciated.
John
Attachments
led7seg3.jpg
led7seg3.jpg (21.84 KiB) Viewed 5823 times

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: 7 Segment Display control

Post by Enamul »

Hi
Can you please post your program so that i can follow clearly what you are saying?
Enamul
University of Nottingham
enamul4mm@gmail.com

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: 7 Segment Display control

Post by JLeith »

Hello Enamul,

Thank you taking the time to look at my issue.

I have added my file to this post. Now it is in ruff development. To activate the Home score flip switch A5 and leave operational to see the digits advance.

The task I have set up is the HOME Team Score the task is have the Unit side (Seg 4) to advance from 1 - 9 then display ( 0 ) for 10th. Then the jump to HOME_TEN and advance the TENS to ( 1 ) to give a score reading of "10" then the flow should drop back to UNITS and count to 9 again. Then back to HOME_TEN to advance to "2" and then back to HOME to count to 9. The score can only reach 29 then back to ( 0 0 ).

I hope there is a easy way to address the segments advancing for no reason. When I see the variable for ( Home_Ten) it says value 1 and for some reason the LED Seg 3 follows the Seg 4 UNITS.

John
Attachments
Direction Flow.fcf
Scoreboard development
(78.19 KiB) Downloaded 305 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: 7 Segment Display control

Post by Benj »

Hello John,

If you go to Help -> About Flowcode then which version are you running?

I am running the latest version for PIC which is v5.4 and I cannot seem to replicate the issue.

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: 7 Segment Display control

Post by JLeith »

Hello Benj,

Thank you for helping. When you looked at my file and activate the toggle switch for "Home Score" you should see the Ten's unit follow the Units after it says a Score of ( 11 ).

Here is the current version I just loaded on Friday.
Flowcode5 Version.jpg
Flowcode5 Version.jpg (19.14 KiB) Viewed 5791 times
Benj I have a question to ask on how I can better design my scanning for inputs. When I set the option to run full I can't get the input to be picked up on a clean sweep.
My goal is to have a receiver send in a Ground momentary pulse that I'm trying to capture. It would be like using a push button and catching the down action in time.

I have placed a new test version of my file. ( Direction Flow 414 ) Activate the "Ball" switch and see what happens to the top displays.

John
Attachments
Direction Flow 414.fcf
This is a test version
(71.49 KiB) Downloaded 274 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: 7 Segment Display control

Post by Benj »

Hello John,

I have had a bit of a tidy up with your program and have changed some key parts.

Firstly your program was oriented so it worked like this.

Main -> Switch_input -> Ball_Display -> Switch_input -> Ball_Display -> Switch_input -> Ball_Display -> Switch_input -> .......

This is never going to work on hardware as the PIC microcontrollers only allow for 8 jumps away from the main macro.

I have therefore changed this so that it works correctly and drops back to the main after every Switch_Input macro call.

I have also added a timer interrupt. The 7-seg displays are all connected together using the same data pins so any displays that are enabled will always show the same value. Therefore for 7-segs to work you have to loop through them at high speed to ensure that all the displays are drawn. The human persistence of vision allows us to see all displays on at once and eliminates the flicker. I might not have got the timer frequency quite right for flicker free operation so you may have to tweak this on the hardware.

I don't think I've fixed all the problems but hopefully you will be able to proceed now.
Attachments
Direction Flow 414.fcf
(75.92 KiB) Downloaded 329 times

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: 7 Segment Display control

Post by JLeith »

Hello Benj,

Thank you for adding in the Interrupt to control the macro. I thought having so many calls would mess it up and now I see how to address the mess.

Can I ask how Flowcode displays the 7 Segment. I thought I could place the common Anode lead to one PORT A where in the real it would be GRD or +5 depending.

In Flowcode if I have the "Display" selected as LedSeg 5 I would expect that ONLY LedSeg 5 would change ??

I saved your configuration and I again thank you.

Benj is there a better way to address my design ? When I do finally get it working I will be receiving signals via PORT B 0 - 7 with the PORT B ports set to ( INPUT ) and then change PORT B ports 0 - 7 as ( Output ).

I don't know how to simulate this in Flowcode. So I thought I would develop the thought on simulation of Switches as my input and the 7 Segment as my output.

Here is the current challenge in selecting BALL to display 2 and I was hoping to get Strike to 1 and have a display on BALL 2 Strike 1. Instead I get (Ball 2) - ( Strike 2 ) + (Out 2).
Flowcode 5 triple.jpg
Flowcode 5 triple.jpg (25.97 KiB) Viewed 5776 times
I have included a PDF word document to help wrap my thoughts on how Flowcode displays the segments. Had to make it PDF to upload.

I must say I'm very impressed with Flowcode offering the ability to see how the code works first hand.

Benj if I can send you a direct email I could send you a PowerPoint and a more detail drawing of my goal to restore or scoreboard.

John
Attachments
Flowcode 5 7 Segment connection PDF.pdf
(106.01 KiB) Downloaded 375 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: 7 Segment Display control

Post by medelec35 »

JLeith wrote:
Can I ask how Flowcode displays the 7 Segment. I thought I could place the common Anode lead to one PORT A where in the real it would be GRD or +5 depending.
Hi John,
No it will not work like that.
Lets take a common anode display.
Since all the cathodes of each display are connected together, e.g segment a of Display 1 is connected to a of Display 2 which is connected to a of Display 3 etc, then if you put all the anodes together all the three displays will only show the same value!

So what you need to do is only make one anode at a time positive, then when say all the the 3 displays have the following low:
a, b, c,d,e,f then only the display with anode high will show the number 0.The other two displays will have their anodes at a low, so there is nothing on there displays.

so to get all the displays look like there are showing the correct digit, each 7seg display anode has to be quickly go high, so number is shown then go low, so number goes out, it this is done quick enough then due to persistence of vision, each display will look like its permanently lit with a solid number.

Hope I have explained it ok.

Martin

Edit Just looked at PDF you have posted and your 7seg are connected up as common cathode, not common anode. So when each individual cathode is low, then display is enabled. When anode (a to g) goes high then corresponding segment will light.

Since you have stated about common anode then I'm not sure which one is correct.

Have you got a data sheet or part number for your 7seg display?
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: 7 Segment Display control

Post by JLeith »

Hello Martin,

I tried messing with the On off states of the Anodes to only turn on the PortA bit say for Ball segment and allow it to read the Port B common bits. Now when I turn off the Port A bit I loose the Ball display digit.

When I go ahead with sending the Port B result to my Electrochemical Display segments they work exactly like turning on the Port A bit and reading the Port B and then turn off the Port A. The Electrochemical Display use magnets to maintain the vane displays.

When I set the Anode ( Port A ) to a low the display digit goes out and there is nothing to redisplay ?

Example if I have segment BALL display 1 and now Segment Strike get say 2 if I turn off Ball Anode I loose the display 1.

Unless I'm missing something.

John

Post Reply