Following is my code to produce 23 Hz signal
list p=12f629, f=inhx32
#include <p12f629.inc>
__CONFIG _WDT_OFF&_INTRC_OSC_NOCLKOUT&_BODEN_ON&_CP_OFF&_PWRTE_ON
COUNTER equ 0x21
COUNTER1 equ 0x22
temp equ 0x23
M1 equ 0x24
M2 equ 0x25
M3 equ 0x26
M4 equ 0x27
COUNTER2 equ 0x28
COUNTER3 equ 0x29
;ANSEL equ 0x9F
;cblock 0x20
;d1
; d2
;endc
;**********************************************************************
ORG 0x000 ; processor reset vector
goto init ; go to beginning of program
ORG 0x004 ; interrupt vector location
init:
call 0x3FF ; retrieve factory calibration value
bsf STATUS,RP0 ; set file register bank to 1
movwf OSCCAL ; update register with factory cal value
bcf STATUS,RP0 ; set file register bank to 0
CLRF GPIO ;Init GPIO
MOVLW 07h ;Set GP<2:0> to
MOVWF CMCON ;digital IO
BSF STATUS,RP0 ;Bank 1
;CLRF ANSEL ;Digital I/O
MOVLW b'00001111' ;Sets inputs and outputs
MOVWF TRISIO ;and set outputs
BCF STATUS,RP0 ;Bank 0
;movlw 20h
;movwf GPIO
;movlw 02h
;movwf COUNTER
;Variable definitions
;M1 on time of pulse
;M2 off time of pulse
;M3 number of pulses
;M4 on time of pulse
;M5 off time of pulse
;M6 number of pulses
movlw .22 ;on time of pulse #1
movwf M1
movlw .22 ;off time of pulse #1
movwf M2
goto main
main:
call lowtest
;decfsz COUNTER,1
goto main
lowtest:
bsf GPIO,5
call Delay
bcf GPIO,5
call Delay1
return
Delay movf M1,0
movwf COUNTER
nop
decfsz temp,f
goto $-2
decfsz COUNTER,f
goto $-4
retlw 00
Delay1 movf M2,0
movwf COUNTER1
nop
decfsz temp,f
goto $-2
decfsz COUNTER1,f
goto $-4
retlw 00
end
list p=12f629, f=inhx32
#include <p12f629.inc>
__CONFIG _WDT_OFF&_INTRC_OSC_NOCLKOUT&_BODEN_ON&_CP_OFF&_PWRTE_ON
COUNTER equ 0x21
COUNTER1 equ 0x22
temp equ 0x23
M1 equ 0x24
M2 equ 0x25
M3 equ 0x26
M4 equ 0x27
COUNTER2 equ 0x28
COUNTER3 equ 0x29
;ANSEL equ 0x9F
;cblock 0x20
;d1
; d2
;endc
;**********************************************************************
ORG 0x000 ; processor reset vector
goto init ; go to beginning of program
ORG 0x004 ; interrupt vector location
init:
call 0x3FF ; retrieve factory calibration value
bsf STATUS,RP0 ; set file register bank to 1
movwf OSCCAL ; update register with factory cal value
bcf STATUS,RP0 ; set file register bank to 0
CLRF GPIO ;Init GPIO
MOVLW 07h ;Set GP<2:0> to
MOVWF CMCON ;digital IO
BSF STATUS,RP0 ;Bank 1
;CLRF ANSEL ;Digital I/O
MOVLW b'00001111' ;Sets inputs and outputs
MOVWF TRISIO ;and set outputs
BCF STATUS,RP0 ;Bank 0
;movlw 20h
;movwf GPIO
;movlw 02h
;movwf COUNTER
;Variable definitions
;M1 on time of pulse
;M2 off time of pulse
;M3 number of pulses
;M4 on time of pulse
;M5 off time of pulse
;M6 number of pulses
movlw .22 ;on time of pulse #1
movwf M1
movlw .22 ;off time of pulse #1
movwf M2
goto main
main:
call lowtest
;decfsz COUNTER,1
goto main
lowtest:
bsf GPIO,5
call Delay
bcf GPIO,5
call Delay1
return
Delay movf M1,0
movwf COUNTER
nop
decfsz temp,f
goto $-2
decfsz COUNTER,f
goto $-4
retlw 00
Delay1 movf M2,0
movwf COUNTER1
nop
decfsz temp,f
goto $-2
decfsz COUNTER1,f
goto $-4
retlw 00
end