LED 7segment blanking and negative numbers possible?

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

Post Reply
rstechnics
Posts: 16
Joined: Mon Oct 29, 2007 12:17 pm
Has thanked: 2 times
Been thanked: 1 time
Contact:

LED 7segment blanking and negative numbers possible?

Post by rstechnics »

Hello,
for a new project i need to display an actual temperature value on the 4x 7Segment display E-block.

For normal positive values this is working fine:
the integer-variable Actual_TEMP is separated in 4 digits (by the MOD/100 etc. lines) and then via an TRM0_INT send and multiplexed to the LED-display using the LED7SEG4(0) macro's SHOWDIGIT subsequently for all 4 display''s.

Questions:
1. When the value of Actual_TEMP goes negative, temperature below 0Β°C, the display starts showing wrong values.
In wich way is it possible to give a minus '-' symbol at the most left Display with the actual temperature on the 3 other display's, like "-10" Β°C

2. Is it possible to give 4 '-' minus symbols on all 4 display's "----" in an Overload situation?

3. How can i blank out (temporarely) one or more display's?
This for blanking out the leading zero's etc., displaying " 10" Β°C in stead of " 0010" Β°C

many thanks in advance for your reaction,
kind regards, Luuk Aalders
(RS Technics BV - The Netherlands)
kind regards,
Luuk Aalders

RS Technics BV
for electronics engineering and industrial controls
The Netherlands
www.rstechnics.nl

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: LED 7segment blanking and negative numbers possible?

Post by Benj »

Hello

In answer to your questions.

1) You can do a initial compare to see if the input value is less then 0. If the value is less then 0 then show the first digit as the minus sign and then convert the number back to a positive by subtracting the negative value from 0.

2) Yes the minus symbols can be showed by writing values directly to the port. The particular anode will need to be set and the cathodes that are off also need to be set. Cathodes that are on should be cleared. You can do this using 2 output icons, 1 for the anode port and 1 for the cathode port.

3) Simply include a decision in your interrupt routine that doesnt show the first two digits etc if a flag is given the value 2 etc. The value of 2 can be set when the number is converted to 4 individual digits.

Hope this helps.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED 7segment blanking and negative numbers possible?

Post by Creative25 »

Hi there.
I am trying to display negative numbers on a seven segment display.
I get it right do make a minus sign.
Do not quite understand how to test and convert the Number. Do you put an if "<0" in a decision box to see if the number is negative and then make a calculation?
The other question can I put a negative number into a decision box?

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: LED 7segment blanking and negative numbers possible?

Post by Benj »

Hello,

Only the INT variable type in Flowcode can go negative.

Using this in a decision to detect if a number is negative will work fine.

e.g. var < 0

You can also put negative numbers in the decision icon.

e.g. var = -25

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED 7segment blanking and negative numbers possible?

Post by Creative25 »

Hi Benj
Thanks for the Advice,
the minus numbers are showing correctly now.

First it did not work until I put a separate variable for the calculation.
First i had the following calculation.
Temp= 0-Temp
This made the the number to continuously convert from negative to positive and then back to negative.
So I put a new variable
Tempdisp= 0-Temp
Now it works perfectly.

I put the calculation into the refresch interrupt for the 7 segment display is that the right way to do it?

What happened to the thanks button on the website?

Best Regards:
Uli

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED 7segment blanking and negative numbers possible?

Post by Creative25 »

Hi there,
I am answering my own question.
I had to remove the calculation from the Interrupt, or else it Gives an error message.

Regards:
Uli

Post Reply