hotrodhed120
Member
This is my first project with the 10f222 and I'm having a problem writing to the GPIO pins in this program. I'm using MPLAB sim and when I get to the MOVWF GPIO command the pins don't change.
I only have one output (0) and I have tried BSF, BCF, MOVWF, and they don't have any effect.
I've looked though the datasheet but I haven't found anything that I haven't already tried, but, I'm probably just overlooking something.
I only have one output (0) and I have tried BSF, BCF, MOVWF, and they don't have any effect.
I've looked though the datasheet but I haven't found anything that I haven't already tried, but, I'm probably just overlooking something.
Code:
list p=10F222 ; list directive to define processor
#include <p10F222.inc> ; processor specific variable definitions
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _MCPU_OFF & _IOFSCS_4MHZ
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
;***** VARIABLE DEFINITIONS
TEMP_VAR UDATA
TEMP RES 1 ;example variable definition
COUNT0 RES 1 ;COUNTER FOR DELAY
COUNT1 RES 1 ;COUNTER FOR DELAY
TEMPOUTPUT RES 1 ;TEMP FILE FOR OUTPUT
;**********************************************************************
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
GOTO START
;SUBROUTINES
DELAYP100
CLRF TMR0
CLRF COUNT0
MOVLW D'206'
MOVWF COUNT0
RESET0 MOVLW D'198'
MOVWF TMR0
LOOP0 DECFSZ TMR0,1
GOTO LOOP0
DECFSZ COUNT0,1
GOTO RESET0
RETLW D'0'
;================================================================
start
MOVLW B'00000110' ;
TRIS GPIO ;
CLRF GPIO ;
MOVLW B'11010111' ;
OPTION
;
MOVLW B'10000100' ;
MOVWF ADCON0 ;
MOVLW B'11111111' ;
MOVWF GPIO ;
CALL DELAYP100 ;
MOVLW D'0' ;
MOVWF GPIO ;
CALL DELAYP100 ;
END