Topic: DMD0026

Help File Version: 2.10.0.636

SEG - Hex / BCD to 7 Segment Display


The Hex / BCD to 7 Segment Display (SEG) instruction is used to convert a single four digit HEX value to seven segment display format. Remaining digits will set to '3F' - the seven segment display for the value 0.

 

 

A seven segment display, as its name indicates, is a single display that is composed of seven individual elements (typically labeled A through G). The On / OFF states of the individual elements can be combined to produce simplified representations of numbers and letters.

 

The following chart that details which segments of the display are set ON to generate the ten decimal numerals (0 - 9) and six hexadecimal "letter digits" (A - F) of the hexadecimal number system.

 

 

 

 

Segments

 

Input
(Decimal)

Input
(Hex)

Output
(Hex)

g

f

e

d

c

b

a

Value on Display

0

0x00

0x3F

0

1

1

1

1

1

1

0

1

0x01

0x06

0

0

0

0

1

1

0

1

2

0x02

0x5B

1

0

1

1

0

1

1

2

3

0x03

0x4F

1

0

0

1

1

1

1

3

4

0x04

0x66

1

1

0

0

1

1

0

4

5

0x05

0x6D

1

1

0

1

1

0

1

5

6

0x06

0x7D

1

1

1

1

1

0

1

6

7

0x07

0x07

0

0

0

0

1

1

1

7

8

0x08

0x7F

1

1

1

1

1

1

1

8

9

0x09

0x67

1

1

0

0

1

1

1

9

10

0x0A

0x77

1

1

1

0

1

1

1

A

11

0x0B

0x7C

1

1

1

1

1

0

0

b

12

0x0C

0x39

0

1

1

1

0

0

1

C

13

0x0D

0x5E

1

0

1

1

1

1

0

d

14

0x0E

0x79

1

1

1

1

0

0

1

E

15

0x0F

0x71

1

1

1

0

0

0

1

F

 


Parameters:

Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.

 

4 Digit Hex / BCD Value - specifies the input value to convert. This can be any constant value or any readable numeric location.

 

4x8 Bit a-g Output - specifies a numeric memory location to store the converted value. This can be any writable numeric location. Use cast operations to truncate the Output to the desired number of digits: for example, :UB0 (unsigned Byte) for one digit, :UW0 (unsigned word) for two digits.

 


See Also:

GRAY - Gray Code to Integer

 

SCALE - Scale Value

 

SEG - Hex / BCD to 7 Segment Display

 


Related Topics:

STR2INT - Convert String to Integer

 

STR2REAL - Convert String to Real

 


Rung Example: