Friday 1 April 2011

Compiling *.asm Code to INTEL HEX Format

If the *.asm code list been written then we must convert that in to *.hex then can be downloaded in to flash AT89C51 memory.

For example, the code list is shown below

$mod51

org 00h

jmp mulai

;program dimulai di sini

mulai:

mov r1, #05h

loop:

dec r1

mov a, #01h

mov p1, a

call tunda

kiri:

rl a

mov p1, a

call tunda

cjne a, #80h, kiri

kanan:

rr a

mov p1, a

call tunda

cjne a, #01h, kanan

cjne r1, #00h, loop

ljmp mulai

;

tunda:

mov r4, #02h

ulang:

dec r4

mov r3, #0ffh

tunda1:

dec r3

mov r2, #0ffh

tunda2:

dec r2

cjne r2, #00h, tunda2

cjne r3, #00h, tunda1

cjne r4, #00h, ulang

ret

end

(you must refer to this page for the circuit diagram), when this code been written (for example using notepad), then save it with .asm file extension) by using ASEM.exe (click here to download ) we can to compile and convert it in to *.hex. This process is shown below.


If compiling process completed, and there is no error (we can to assure by open *.lst file extension), so the *.hex can be downloaded in to flash memory of AT89C51


source : http://trensains.com/compile_to_hex.htm

No comments: