PDA

View Full Version : Suppress leading zeros



Adrian
- 24th June 2008, 15:00
Is it possible to suppress leading zeros within a standard 7 segment multiplexed display routine (as sample MELABS http://melabs.com/resources/samples/pbp/7segment.pbp)?
A pointer in the right direction would be appreciated

Thanks

Adrian

Acetronics2
- 24th June 2008, 16:04
Hi,

suppose we have 4 digits ...

IF Value < 1000 ... first digit = 0 ... so, do not show it ( or print blank ! )
IF Value < 100 ... second digit = 0 ... so, do not show it
IF Value < 10 ... Third digit = 0 ...

or use a flag ...

for digit 1 to 4

IF Digit = 0 AND Flag = 0 then

... do not show it : Flag = 0

ELSE

... Show it : Flag = 1

ENDIF

Next digit

Alain

sayzer
- 24th June 2008, 16:37
Hi,
...

or use a flag ...

for digit 1 to 4

IF Digit = 0 AND Flag = 0 then

... do not show it : Flag = 0

ELSE

... Show it : Flag = 1

ENDIF

Next digit

Alain


If the digit variable in this loop can only take values from 1 to 4, how can "IF Digit = 0 AND Flag = 0 then..." work?


-------------------------------

Adrian
- 24th June 2008, 16:37
You're a star..many thanks

Adrian

Acetronics2
- 24th June 2008, 21:45
Hi, Sayzer

Would " If digit_value ... " help you to understand how this test is supposed to work ???

I know PbP is case insensitive, "for digit 1 to 4" is not a PbP correct writing, only here to explain things ...but ... May I suppose you need further explanation ... ???

Alain