Hi!
I have a problem with delay routines! tryed many, but my led just wont flash!
this is the last code i tryed on my PIC, but the led is constant on.
I have used the PicLoops Delay loopsV2.2 program in this example, but also tryed the Delaycode generator @ https://www.golovchenko.org/cgi-bin/delay
non of witch i got to work!
in this code the delay time should be 1s according to the program!
what am i doing wrong?
I have a problem with delay routines! tryed many, but my led just wont flash!
this is the last code i tryed on my PIC, but the led is constant on.
I have used the PicLoops Delay loopsV2.2 program in this example, but also tryed the Delaycode generator @ https://www.golovchenko.org/cgi-bin/delay
non of witch i got to work!
in this code the delay time should be 1s according to the program!
what am i doing wrong?
Code:
#include <p16f877a.inc> ; processor specific variable definitions
__CONFIG _DEBUG_OFF&_CP_ALL&_WRT_HALF&_CPD_ON&_LVP_OFF&_BODEN_OFF&_PWRTE_ON&_WDT_OFF&_HS_OSC
;--------------------------CONSTANTS----------------------------------------
CounterA equ 08h
CounterB equ 09h
CounterC equ 0Fh
;---------------------------port define-----------------------------------
ORG 00H ;the address of entrance program
BSF STATUS,RP0 ;select BANK1
MOVLW b'00000000' ;set RA0-5 to outputs
MOVWF TRISC
BCF STATUS,RP0 ;select BANK0
;--------------------------program------------------------------------------
start
bsf PORTC,0 ;RC0 high
call Delay
bcf PORTC,0 ;RC0 low
call Delay
goto start
;-------------------------subroutine delay--------------------------------
Delay
movlw D'6'
movwf CounterC
movlw D'19'
movwf CounterB
movlw D'173'
movwf CounterA
loop
decfsz CounterA,1
goto loop
decfsz CounterB,1
goto loop
decfsz CounterC,1
goto loop
retlw 0
end
Last edited: