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.

help in converting asm code to c code?

Status
Not open for further replies.

alkid

Junior Member level 1
Joined
Sep 24, 2007
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,464
spi0dat

INT0: CLR CSN
MOV SPI0DAT, #20H
LCALL SPI
MOV SPI0DAT, #08H
LCALL SPI
SETB CSN
CLR CSN
MOV SPI0DAT, #27H
LCALL SPI
MOV SPI0DAT, #7EH
LCALL SPI
SETB CSN
MOV SPI0DAT, #0E1H
LCALL SPI
SETB CSN
CLR CSN
MOV SPI0DAT, #0E2H
LCALL SPI
SETB CSN
RET
anyone know of anyway i can change the asm code into c code?
 

alzomor

Advanced Member level 2
Joined
Jun 9, 2005
Messages
678
Helped
39
Reputation
78
Reaction score
8
Trophy points
1,298
Location
Cairo
Activity points
6,417
Hi

1st you should know the instruction set used in this asm code
2nd draw a flow chart representing this asm code
3rd convert the flow chart into C code

also you can search for a asm to flow chart program which supports your instruction set so you can skip 1st and 2nd step

Salam
Hossam Alzomor
www(.)i-g(.)org
 

cfant

Full Member level 3
Joined
Apr 4, 2001
Messages
188
Helped
25
Reputation
50
Reaction score
6
Trophy points
1,298
Location
California, USA
Activity points
1,151
Jugging from the code this is programming spi controller. You will also need to know wwhat is the SPI function doing. Someboy already posted this question somewhere else, and the answer would be something like this:

CLR CSN --> will clear CSN, what ever it is. So CSN is probably a pointer.

void INT0(void)
{
*CSN = 0 ;
SPI0DAT = 0x20 ;
SPI(SPI0DAT) ;
SPI0DAT = 0x08 ;
SPI(SPI0DAT) ;
*CSN = 1 ;
.
.
.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top