Hi all,
I feel pretty silly: I can't turn PORTA and PORTB to all digital output on a Pic25K20!
What did I overlook?
I am new to using C on a Pic, so I thought the problem was C related, therefore I also wrote the program in ASM. Unfortunately the problem remains the same.
and now for the ASM version (identical code, identical problem)
I looked at the values of some other related SFR (the ones I could think of):
ADCON0 = 0x00 (ADC is disabled)
ADCON1 = 0x00 (Vref- and Vref+ not used)
CCP1CON = 0x00 (Capture/Compare/PWM off)
CCP2CON = 0x00 (ditto)
I am now running out of ideas, any suggestion will be welcome.
Thanks
I feel pretty silly: I can't turn PORTA and PORTB to all digital output on a Pic25K20!
What did I overlook?
I am new to using C on a Pic, so I thought the problem was C related, therefore I also wrote the program in ASM. Unfortunately the problem remains the same.
Code:
#include <p18cxxx.h>
void main (void)
{
// Disable all Analog inputs
ANSEL = 0;
ANSELH = 0;
// PORTS A,B and C are all Outputs
TRISA = 0;
TRISB = 0;
TRISC = 0;
// Set All the bits
PORTA = 0xFF; // PORTA is set to 0xD0 instead of 0xFF, LATA too
PORTB = 0xFF; // PORTB is set to 0xF6 instead of 0xFF and LATB to 0xE0
PORTC = 0xFF; // Yeah! PORTC and LATC both get 0xFF
while (1) {}
}
and now for the ASM version (identical code, identical problem)
Code:
list p=18f25K20 ; list directive to define processor
#include <p18F25k20.inc> ; processor specific variable definitions
ResetCode org 0x000
goto Main
HighInteruptCode ORG 0x008 ; High Interrupt vector address
retfie FAST ; return from interrupt
LowInteruptCode ORG 0x0018 ; Low interrupts vector address
retfie ; return from interrupt
Main
; Disable all Analog input
clrf ANSEL
clrf ANSELH
;PORTS A,B and C are all Outputs
clrf TRISA
clrf TRISB
clrf TRISC
; Set All the bits
setf PORTA ; PORTA is set to 0xD0, LATA too
setf PORTB ; PORTB is set to 0xF6 and LATB to 0xE0
setf PORTC ; Yeah! PORTC and LATC get 0xFF
LoopHere
bra LoopHere
END ; end of program
I looked at the values of some other related SFR (the ones I could think of):
ADCON0 = 0x00 (ADC is disabled)
ADCON1 = 0x00 (Vref- and Vref+ not used)
CCP1CON = 0x00 (Capture/Compare/PWM off)
CCP2CON = 0x00 (ditto)
I am now running out of ideas, any suggestion will be welcome.
Thanks