Hello,
The problem is that the asm code builds, but not working as expected. Could anyone help me with this problem? Thank you for your time.
Pin#2 = VCC (5v)
Pin#4 = GPIO,1 (Programmed as an input)
Pin#5 = GPIO,0 (Programmed as an output) Here I do not get any signs of voltage when testing output
Pin#7 = Ground
The problem is that the asm code builds, but not working as expected. Could anyone help me with this problem? Thank you for your time.
Pin#2 = VCC (5v)
Pin#4 = GPIO,1 (Programmed as an input)
Pin#5 = GPIO,0 (Programmed as an output) Here I do not get any signs of voltage when testing output
Pin#7 = Ground
Code:
list p=10F222 ; list directive to define processor
#include p10F222.inc ; processor specific variable definitions
__CONFIG _MCLRE_ON&_CP_OFF&_WDT_OFF&_MCPU_OFF&_IOFSCS_4MHZ
;***** VARIABLE DEFINITIONS
TEMP_VAR UDATA
temp1 RES 1 ;DELAY REGISTER1
temp2 RES 1 ;DELAY REGISTER2
temp3 RES 1 ;DELAY REGISTER3
temp4 RES 1 ;DELAY REGISTER4
temp5 RES 1 ;TIMING REGISTER
temp6 RES 1 ;TINING REGISTER
;**********************************************************************
RESET_VECTOR CODE 0xFF ; processor reset vector
; Internal RC calibration value is placed at location 0xFF by Microchip
; as a movlw k, where the k is a literal value.
MAIN CODE 0x000
movwf OSCCAL ; update register with factory cal value
initialize:
movlw B'0010'
tris GPIO ; INITIALIZE
clrf ADCON0 ; ADC DISABLE
clrf GPIO
movlw b'00001000'
option ; ENABLE GPIO2 AS A DIGITAL PORT
clrf GPIO
START:
SCAN1:
btfss GPIO,1
goto SCAN1
ENSURE:
btfsc GPIO,1
goto ENSURE
call LOOP1
COUNTDOWN:
movlw 0xFF
movwf temp5
movlw 0xFF
movwf temp6
COUNTDOWN2:
btfsc GPIO,1
goto RELAYACTIVATE
decfsz temp5
goto COUNTDOWN2
movlw 0xFF
movwf temp5
decfsz temp6
goto COUNTDOWN2
goto SCAN1
RELAYACTIVATE:
bsf GPIO,0
call LOOP1
call LOOP1
call LOOP1
SCAN2:
btfss GPIO,1
goto SCAN2
ENSURE2:
btfsc GPIO,1
goto ENSURE2
call LOOP1
COUNTDOWN3:
movlw 0xFF
movwf temp5
movlw 0xFF
movwf temp6
COUNTDOWN4:
btfsc GPIO,1
goto RELAYDEACTIVATE
decfsz temp5
goto COUNTDOWN4
movlw 0xFF
movwf temp5
decfsz temp6
goto COUNTDOWN4
goto SCAN2
RELAYDEACTIVATE:
bcf GPIO,0
reset
LOOP1:
movlw 0x00
movwf temp1
movlw 0xF0
movwf temp2
LOOP2:
decfsz temp1
goto LOOP2
decfsz temp2
goto LOOP2
RETLW 0
end
Attachments
-
154.7 KB Views: 17