Araine
Araine

Reputation: 15

Intel 8051 EdSim51 7 Segment Display

Why does when I remove the "B" in the binary on the code, it messes up when displaying the number?

ORG 0000H
START:
    SETB P3.3
    SETB P3.4
    MOV P1, #11111001
    CALL DELAY
    CLR P3.3
    MOV P1, #10100100
    CALL DELAY
    CLR P3.4
    SETB P3.3
    MOV P1, #10110000
    CALL DELAY
    CLR P3.3
    MOV P1, #10011001
    CALL DELAY
    JMP START
DELAY: MOV R0, #45H
    DJNZ R0, $
    RET
END

Thank you

Upvotes: 0

Views: 738

Answers (2)

osLIII
osLIII

Reputation: 31

'B': Means binary, 'H': means hexidecimal...

Upvotes: 0

the busybee
the busybee

Reputation: 12673

Because the assembler looks at the last character to determine the base of the number.

If you use:

MOV P1, #10B

It means the binary value 10, giving a decimal 2.

If you use:

MOV P1, #10

It means the decimal 10.

If you use:

MOV P1, #10H

It means the hex value 10, giving a decimal 16.

Note: Your assembler should have warned you about a number overflow or so.

Upvotes: 1

Related Questions