I thought I had my large code finalized, and now half of my boards have a problem.
The RA1 input always reads 0. I have ANSEL = 0, ANSELH = 0, and have various settings of the other registers from the datasheet.
I also tried using the alldigital.pbp include file.
Below is a simplified test program (with the same problem) that flashes one of my existing LED's(RA0) and another LED(RE1) is controlled with a toggle switch input. I have a 10K pull up resistor on the switch input (RA1) to 5V, and I have measured the voltage on the chip pin. It changes state correctly with the switch, but the LED(RE1) stays on.
If I use any port other then RA1, it works on all the PIC's.
Also, all of the chips are running the code...cause the first LED flashes as it is supposed to.
I feel that I am not getting something disabled correctly with the AD conv or the Comparators.
This is my first time posting. I have spent hours with the datasheet. I usually find my answers by just reading others...but?
Thanks,
Paul
#CONFIG
__config _CONFIG1, _HS_OSC & _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF
__config _CONFIG2, _WRT_OFF & _BOR40V
#ENDCONFIG
DEFINE OSC 20
ANSEL = 0
ANSELH = 0
ADCON0 = 0
ADCON1 = 0
CM1CON0 = 0
CM2CON0 = 0
CM2CON1 = 0
CCP1CON = 0
CCP2CON = 0
TRISA = %000000010
TRISB = 0
TRISC = 0
TRISD = 0
TRISE = 0
Startup:
LOW PORTA.0
PAUSE 250
HIGH PORTA.0
PAUSE 250
IF PORTA.1 = 0 THEN
LOW PORTE.1
ELSE
HIGH PORTE.1
ENDIF
GOTO Startup
Bookmarks