zh3ng
Newbie level 5
PIC16F628A
I'm a newbie with PIC programming. I'm trying to program PIC16F628A for 10 secs delay, after the delay 10sec is done, it will control the relay from RA2's pins.
Below this is the code, but its not working, can somebody help me and tell me what is wrong?
list p=16f628a
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _LVP_OFF & _BODEN_ON & _MCLRE_OFF
#include <p16F628a.inc>
cblock
d1
d2
d3
endc
; program starts here
main
org 0x00
movlw 7
movwf CMCON
clrf PORTA
clrw
tris PORTA ; porta all output
clrf PORTB
movlw 0xf0 ; pb4-7 inputs
tris PORTB
bsf STATUS, RP0 ; bank 1
bcf OPTION_REG, NOT_RBPU ;internal pullups on port B enabled
bcf STATUS, RP0 ;bank 0
Call Delay
movlw 0x04 ; RA2 is output
movwf PORTA
Delay
;1999996 cycles
movlw 0x11
movwf d1
movlw 0x5D
movwf d2
movlw 0x05
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;4 cycles (including call)
return
end
I'm a newbie with PIC programming. I'm trying to program PIC16F628A for 10 secs delay, after the delay 10sec is done, it will control the relay from RA2's pins.
Below this is the code, but its not working, can somebody help me and tell me what is wrong?
list p=16f628a
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _LVP_OFF & _BODEN_ON & _MCLRE_OFF
#include <p16F628a.inc>
cblock
d1
d2
d3
endc
; program starts here
main
org 0x00
movlw 7
movwf CMCON
clrf PORTA
clrw
tris PORTA ; porta all output
clrf PORTB
movlw 0xf0 ; pb4-7 inputs
tris PORTB
bsf STATUS, RP0 ; bank 1
bcf OPTION_REG, NOT_RBPU ;internal pullups on port B enabled
bcf STATUS, RP0 ;bank 0
Call Delay
movlw 0x04 ; RA2 is output
movwf PORTA
Delay
;1999996 cycles
movlw 0x11
movwf d1
movlw 0x5D
movwf d2
movlw 0x05
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;4 cycles (including call)
return
end