U
uuuuu
Guest
I want to switch on PORTA pins RA4 & RA5 but the problem is that pin RA2
seems to go on as well (by on I mean low). Attached my code, I was
wondering if anyone can help to find the problem. BTW I have 3 warnings
when compiling that the wrong bank is selected, why am I getting these
warnings, I used the BANKSEL macro ?
Tia.
list p=16F676 ; list directive to define processor
#include <p16f676.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _BODEN & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _CPD_OFF
;******************************************************************************
;Defines
;******************************************************************************
#define Bank0 0x00
#define Bank1 0x80
;******************************************************************************
;Reset Vector
;******************************************************************************
ORG 0x000 ; processor reset vector
nop ; required by in circuit debugger
goto Init ; go to beginning of program
;******************************************************************************
;Interrupt Vector
;******************************************************************************
ORG 0x004
return ; interrupt trap - returns without re-enabling
;******************************************************************************
;Initialization
;******************************************************************************
Init
;call 0x3FF ; retrieve factory calibration value
; comment instruction if using simulator, ICD2, or ICE2000
BANKSEL Bank1 ; BANK1
movwf OSCCAL ; update register with factory cal value
movlw B'00000000' ;
movwf TRISA ;
clrf ANSEL ; configure A/D I/O as digital
banksel Bank0 ; change back to PORT memory bank
movlw CM2 | CM1 | CM0 ; configure comparator inputs as digital I/O
movwf CMCON ;
;******************************************************************************
;Main
;******************************************************************************
Main
movlw B'11001111' ; RA4, RA5 will be low (= on in my circuit)
movwf PORTA
main1
goto main1
;******************************************************************************
;Subroutines & Functions
;******************************************************************************
END ; directive 'end of program'
seems to go on as well (by on I mean low). Attached my code, I was
wondering if anyone can help to find the problem. BTW I have 3 warnings
when compiling that the wrong bank is selected, why am I getting these
warnings, I used the BANKSEL macro ?
Tia.
list p=16F676 ; list directive to define processor
#include <p16f676.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _BODEN & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _CPD_OFF
;******************************************************************************
;Defines
;******************************************************************************
#define Bank0 0x00
#define Bank1 0x80
;******************************************************************************
;Reset Vector
;******************************************************************************
ORG 0x000 ; processor reset vector
nop ; required by in circuit debugger
goto Init ; go to beginning of program
;******************************************************************************
;Interrupt Vector
;******************************************************************************
ORG 0x004
return ; interrupt trap - returns without re-enabling
;******************************************************************************
;Initialization
;******************************************************************************
Init
;call 0x3FF ; retrieve factory calibration value
; comment instruction if using simulator, ICD2, or ICE2000
BANKSEL Bank1 ; BANK1
movwf OSCCAL ; update register with factory cal value
movlw B'00000000' ;
movwf TRISA ;
clrf ANSEL ; configure A/D I/O as digital
banksel Bank0 ; change back to PORT memory bank
movlw CM2 | CM1 | CM0 ; configure comparator inputs as digital I/O
movwf CMCON ;
;******************************************************************************
;Main
;******************************************************************************
Main
movlw B'11001111' ; RA4, RA5 will be low (= on in my circuit)
movwf PORTA
main1
goto main1
;******************************************************************************
;Subroutines & Functions
;******************************************************************************
END ; directive 'end of program'