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.

How to convert PIC18F ASM code to C code?

Status
Not open for further replies.

ful babu

Full Member level 3
Joined
Nov 11, 2004
Messages
174
Helped
13
Reputation
26
Reaction score
3
Trophy points
1,298
Location
Singapore
Activity points
1,634
i want to convert a PIC18F asm code to c code, is it possible ?

thx
 

convert assembly to c pic18f

NO
 

convert pic18 to c

Hello

This is a weired question indeed, because most companies, if not all, will not bother themselves making any thing that converts ASM code to their C code recognized by the compiler.

As you know, C, Basic, Pascal compilers use what is known as ASM code blocks, so that when you write a C code for example, and then compile it, the compiler simply recognizes what commands you have written, and checks rules to see if there are any mistakes, if you are a lucky guy, then the compiler will add those ASM blocks together to form your ASM code equivalent to what you really want to do, then using an assembler, it will generate the HEX code...

Bear in mind that there are many ways to do the same job, for example, if you want to move from one bank to another, you can simply write:

BSF STATUS,RP0 ;Moving to bank 1

or, equivalently, you can also write:

BANKSEL PORTB;Moving to the bank where PORTB register exists

From this, you can see that its seriously difficult, if not impossible for the company's profit point of view to even think about it.
 

pic18f1320 code asm

metal said:
C, Basic, Pascal compilers use what is known as ASM code blocks

well i tried to bother to convert because , i wanted to use a asm block in hitech18 c compiler which has some loop, but it shows some error, which perfectly compiles in MPLAB, any idea how to do such asm blocks ?

like this one ...

GOTO _28
_08:
BSF 0xfac, 0x5
MOVLW 0x90
MOVWF 0xfab
BSF 0xf94, 0x7
BCF 0xf94, 0x6
_12:
CLRF 0
CLRF 0x1
BTFSC 0xf9e, 0x5
INCF 0x1, F
MOVF 0x1, W
SUBWF 0, W
BZ _26
MOVF 0xfae, W
MOVWF 0x15
BRA _12
_26:
RETURN 0
_28:
MOVLW 0xc
MOVWF 0xfaf
BSF 0xfac, 0x2
CALL _08, 0

thx
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top