1

I am trying to make a code for PIC18F45K50, I am trying to use PORTE as digital input, that means I have to clear ANSELE register which controls this pin behavior

Working on MPLABX 3.30 i tried this line of code:

clrf ANSELE

to clear the register, and I also tried setting the bits of the register individually, but when testing on MPLABX debugger, no matter what I do, the instruction just doesn't do anything and the code goes on. I wish someone can help me or bring me some information about how i can enable this register to be modified in MPLABx

The code im working on is made in ASM

Mike
  • 4,041
  • 6
  • 20
  • 37
  • 1
    Try to elaborate what you're trying to do, I mean what do you expect that the code does, also add your implementation. – Kozmotronik May 21 '23 at 08:20
  • Your MPLABx is pretty old. It' not the issue, but maybe update to v5.3. And please show more code. – Mike May 22 '23 at 07:17

1 Answers1

2

ANSELE has address 0x0F5F so isn't direct addressable because it is not part of access RAM. Check datasheet PIC18(L)F2X/45K50, FIGURE 6-5: DATA MEMORY MAP FOR PIC18(L)F2X/45K50 DEVICES for more information.

Load first the proper BSR value to access these registers, like:

   MOVLB   high ANSELE 
   CLRF    ANSELE

Or use MPLAB assembler directive like...

   BANKSEL ANSELE 
   CLRF    ANSELE
GJ.
  • 10,810
  • 2
  • 45
  • 62