Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

binary to decimal convertion for pic16f84 output?

Status
Not open for further replies.

d@nny

Full Member level 5
Joined
May 28, 2011
Messages
246
Helped
11
Reputation
22
Reaction score
11
Trophy points
1,298
Activity points
3,238
hello!
i am using assembly for pic16f84 . i have the following problem in 7 segment multiplex.
i have the register contains B'00001101' which is 13 in decimal.
now i dont know how to display 13 on 7 segment as i have a look up table having 0 to 9 values.
but how to change binary to decimal 13 and then use lookup table to get code of 3 and than code for one.
please tell me how to convert them.
thanking you in anticipation
danny
 

I could step you through the process d@nny, however the following tutorials can do a better job compared to the limited space of this post:

**broken link removed**

Checkout lesson #12, "Driving 7-Segment LED Displays" it will take you step by step through the process of setting up a lookup table and driving multi digit 7 segment displays.

There are also parallel series of tutorials in Hi-Tech C available at the same site.

BigDog
 


Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Hundreds     equ     0x20
Tens        equ     0x21
units        equ    0x22
working        equ    0x23
numtocon    equ    0x24
count        equ    0x25
 
 
Start
        clrf    Hundreds
        clrf    Tens
        clrf    Units
 
        movlw    d'159'    ;load w with the number to covert
        movwf    numtocon        
 
        movlw    d'8'
        movwf    count        
ShiftLoop
;test lowerbcd        
        movfw    units
        andlw    b'1111'
        movwf    working
        movlw    d'5'
        subwf    working,0
        SKPC        
        Goto    TestUpperNibble
        movlw    d'3'
        addwf    units
TestUpperNibble        
        movfw    units
        andlw    b'11110000'
        movwf    working
        movlw    H'50'
        subwf    working,0
        SKPC        
        goto    Shiftbit
        movlw    H'30'
        addwf    units
shiftbit
        rlf    units,1
        rlf    hundreds,1
        SKPNC
        bsf    hundreds,0
        rlf    numtocon,1
        SKPNC    
        bsf    Units,0
        decfsz    count
        goto    ShiftLoop
        movfw    Units
        Movwf    Tens
        swapf    Tens,1
        movlw    b'1111'
        andwf    Units,1
        andwf    Tens,1
        movlw    d'48'
        addwf    Hundreds
        addwf    Tens
        addwf    Units




I hope this helps.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top