i meet a error when compiling the code for microchip microcontroller PIC18f2455:
#define hardware_setLED(value) LATBbits.LATB5 = value
.....
// disable all analog pin functions, set led pin to output
ANSEL = 0;
ANSELH = 0;
TRISBbits.TRISB5 = 0;
hardware_setLED(0);
....
the output said:
error [192] C:\....\main.c; 320.1 undefined identifier "ANSEL"
errpr [192] C:\....\main.c; 321.1 undefined indentifer "ANSELH"
I GUESS, in pic18f2455 these registers are not called "ANSEL" & "ANSELH"?
actually, I compile this successfully and do not meet this error on my labtop. but meet this when compiling at company.
You said :
I GUESS, in pic18f2455 these registers are not called "ANSEL" & "ANSELH"?
You're right, the PIC18F2455 doesn't have the registers ANSEL and ANSELH. The registers used to configure the ANALOG or DIGITAL function for a pin is the ADCON1. See the page 266 of the datasheet for the complete information of the configuration. (http://ww1.microchip.com/downloads/en/DeviceDoc/39632e.pdf)
But I don't know why this code compiles succesfully on your laptop... Maybe you don't use the same microcontroller...
Maybe this will help you.