Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Translating from Assembly to C Assistance

Posted on 2005-04-25
5
Medium Priority
?
657 Views
Last Modified: 2012-06-27
Hi I need some help translating this code written in assembly to C language
This is to initialize and use a 4 digit LCD module.
Thanks
 
         sda   equ  p3.4
         scl   equ  p3.5
         ;cf    equ  p3.3
         org   0
start:
         ;clr    cf
         mov   dptr,#tab
         mov   b,#10
NEXT:    mov   a,#0ffh
         mov   p1,a
         setb   sda
         nop
         setb   scl
         call  del10ms
         clr   sda
         nop
         nop
         clr   scl
         mov   a,#70h  ;pcf8576
         ;mov   a,#07ch
          ;mov   a,#11000000b   ;pcf8566
         call  wr8
         mov   a,#0c8h
         call  wr8
         mov   a,#80h
         call  wr8
         mov   a,#0e0h
         call  wr8
         mov   a,#70h
         call  wr8
         mov   r7,#8
 start11:
          mov   r4,#20  ;Ò»¹²40¸öSEG£¬¶øÓÖÊÇ4¸öCOM,ËùÒÔÁ½¸öSEG²Å×é³ÉÒ»¸ö¶Î
tran:     mov   a,#00h
          movc  a,@a+dptr
          acall wr8
          djnz  r4,tran
          inc   dptr
          mov   r1,#15h

        SETB   SCL
          NOP
         SETB   SDA

de:      acall del10ms
         acall del10ms
         acall del10ms
         djnz  r1,de
         djnz  b,next
         mov   dptr,#tab


         ajmp  start

wr8:     mov   r5,#0
w:      clr   scl
        rlc   a
         jc    hda
         clr   sda
         sjmp  lda
hda:     setb  sda
lda:     nop
         nop
         setb  scl
         inc   r5
         cjne  r5,#8,w
         clr   scl
         setb  sda
         nop
         nop
         setb  scl
         nop
         nop
         clr   scl
         ret
del10ms: mov   r7,#010h
de1:     mov   r6,#0ffh
de2:      nop
         djnz  r6,de2
         djnz  r7,de1
         ret
T:       MOV   R5,#08fH
LOP1:    mov   r6,#08fh
t5:      nop
         ;nop
         ;nop
         djnz  r6,t5

         DJNZ  R5,LOP1
         RET


TAB:      db   0ffh,00h,0fh,0f0h,0ffh,00h,0fh,0f0h,0ffh,00h,0fh,0f0h,
         db    04h,02h,01h,80h,10h,40h,20h,08h,00h,0FFh
         ;DB    0d7h,03H,0b6H,0a7H,63H,0e5H,0F5H,07H,0F7H,0e7H,0FFH,00h
tab1:   db 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
        db  0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh

         end
0
Comment
Question by:caleno
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:furqanchandio
ID: 13865774
if the program runs fine in assembly then y change to C ?
0
 

Author Comment

by:caleno
ID: 13866448
furqanchandio, I understand better C than assembly. I could follow some of the steps from the program above, but not all of them. I did not write this program, it was given to me.

thanks
0
 
LVL 4

Accepted Solution

by:
furqanchandio earned 375 total points
ID: 14003580
hi

what platform r u using

windows, linux, Mac os ?
0
 

Author Comment

by:caleno
ID: 14062453
Thanks for your help, but I already took care of it. I have it working in C.

Caleno
0
 
LVL 4

Expert Comment

by:furqanchandio
ID: 14076188
hi

thanx

:-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question