PDA

View Full Version : decoding PIC assembly -- need help



uchiprox
- 12th February 2007, 03:35
is there any chance somebody could help me figure out what this code does:



list p=18f458, f=inhx32
#include <p18f458.inc>

BankRam equ 'H20'
cblock BankRAM
COUNT
DVAR
DVAR2
endc

org 00h
goto start

org 1C h
Start
movlw 0
movwf PORTB,0
movwf TRISB,0

IncCount
incf COUNT,1,0
movf COUNT,0,0
movwf PORTB,0
call Delay
goto IncCount

Delay
movlw 00FF
movwf DVAR2

D0
movwf DVAR

D1
decfsz DVAR,1
goto D1
decfsz DVAR2,1
goto D0
return
end


Many thanks!,
uChipRox

Darrel Taylor
- 12th February 2007, 04:19
is there any chance somebody could help me figure out what this code does:
Your guess is as good as mine. But...

In PicBasic Pro it would look like ....
COUNT VAR BYTE

PORTB = 0
TRISB = 0

IncCount:
COUNT = COUNT + 1
PORTB = COUNT
PAUSE 65
GOTO IncCount

Assuming a 4mhz OSC.

@ 20mhz it would be PAUSE 13.
<br>