i tested my code while i had the sim running, seems i cant count well
this is better
Code:
#CONFIGcfg = _HS_OSC ; HS oscillator: High speed crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN
cfg&= _WDT_ON ; WDT enabled
cfg&= _PWRTE_OFF ; PWRT disabled
cfg&= _MCLRE_ON ; GP3/MCLR pin function is MCLR
cfg&= _BODEN_ON ; BOD enabled
cfg&= _CP_OFF ; Program Memory code protection is disabled
cfg&= _CPD_OFF ; Data memory code protection is disabled
__CONFIG cfg
#ENDCONFIG
;pic12f675
;In simple terms toggle a pin every 125 cycles
;start:;set gpio pin high
;delay 125 cycles
;set gpio pin low
;delay 123 cycles
;goto start
CNT VAR BYTE BANK0
TRISIO=%11111110
ASM
START
BSF GPIO , 0
MOVLW 41 ;2
MOVWF _CNT ;1
DL1 ;122 DELAY = 2+3(CNT-1)
DECFSZ _CNT,f
GOTO DL1
BCF GPIO , 0
MOVLW 40 ;2
MOVWF _CNT ;1
DL2
DECFSZ _CNT,f ;119 DELAY = 2+3(CNT-1)
GOTO DL2
NOP ;1
GOTO START ;2
ENDASM
Bookmarks