;*****************************************************************
title "PIC PowerBoard: Program pre PIC18F452"
subtitle "Version 1.00 (c) Jay.slovak 2005"
;*****************************************************************
list p=18F452 R=DEC ; wat is this for
#include <P18F452.INC>
ERRORLEVEL 2 ; is it neccesary to put this?
;********** Definovanie uzivatelskych registrov *******************
Fosc equ 20 ;Frekvencia Oscilatora v Mhz
ZDRZ0 equ D'000' ;
ZDRZ1 equ D'001'
ZDRZ2 equ D'002'
;********** Zaciatok pamati programu ******************************
ORG 0x0004 ; does it ont always start at 0?
GOTO INIT
;********** Inicializacia procesora *******************************
ORG 0x002A
INIT MOVLW h'07' ; some led blinking program
MOVWF ADCON1,a ; doesnt have this , will it still
; work??
CLRF PORTA
CLRF PORTB
CLRF PORTC
CLRF PORTD
CLRF PORTE
CLRF TRISA
CLRF TRISB
CLRF TRISC
CLRF TRISD
CLRF TRISE
GOTO START
;********** Podprogramy Zdrzania @20Mhz *******************
Zdrz8s CALL Zdrz4s ; this is the delay part, by how
GOTO Zdrz4s ; much is the delay ?is it the
; same a the delay just below?
Zdrz4s CALL Zdrz2s
GOTO Zdrz2s
Zdrz2s CALL Zdrz1s
GOTO Zdrz1s
Zdrz1s CALL Zdrz500m
GOTO Zdrz500m
Zdrz500m NOP
MOVLW D'121'
MOVWF ZDRZ0 ; i think Zdrz500m delays by
MOVLW D'171' ; 500ms, but how is it here?
MOVWF ZDRZ1 ;121+171+13?
MOVLW D'13'
MOVWF ZDRZ2
GOTO Zdrz
Zdrz100m NOP ; why do we use a nop ?? to delay ??
NOP ; but i thought delay is done already ?
MOVLW D'122'
MOVWF ZDRZ0
MOVLW D'137'
MOVWF ZDRZ1
MOVLW D'3'
MOVWF ZDRZ2
GOTO Zdrz
Zdrz15m CALL Zdrz5m
CALL Zdrz5m
GOTO Zdrz5m
Zdrz5m CALL Zdrz1m
CALL Zdrz1m
CALL Zdrz1m
CALL Zdrz1m
GOTO Zdrz1m
Zdrz2m CALL Zdrz1m
GOTO Zdrz1m
Zdrz1m MOVLW D'140'
MOVWF ZDRZ0
MOVLW D'7'
MOVWF ZDRZ1
MOVLW D'1'
MOVWF ZDRZ2
NOP
NOP
GOTO Zdrz
Zdrz100 CALL Zdrz40
CALL Zdrz40
CALL Zdrz10
GOTO Zdrz10
Zdrz40 CALL Zdrz10
CALL Zdrz10
CALL Zdrz10
GOTO Zdrz10
Zdrz10 MOVLW D'10'
MOVWF ZDRZ0
MOVLW D'1'
MOVWF ZDRZ1
MOVLW D'1'
MOVWF ZDRZ2
NOP
NOP
GOTO Zdrz
Zdrz DECFSZ ZDRZ0,F
GOTO Zdrz
DECFSZ ZDRZ1,F
GOTO Zdrz
DECFSZ ZDRZ2,F
GOTO Zdrz
Return
;********** Hlavny Program *******************************
Start SETF PORTA
SETF PORTB
SETF PORTC
SETF PORTD
SETF PORTE
CALL Zdrz1s
CLRF PORTA ; this part turns off the LED?
CLRF PORTB
CLRF PORTC
CLRF PORTD
CLRF PORTE
CALL Zdrz1s
GOTO Start
end
hi guys, i think i more or less understand the whole program , just that
i'm a little confuse with the delay part, and for the one in bold that i commented , could u help me check if it's correct??