Re: Setting GPIO and TRISIO
Also... don't overlook the fact that GPIO.3 can only be an INPUT. It defaults to MCLR or "Master Clear with internal pull-up". This means it will reset the chip whenever it goes low.
In order to make it a normal input pin you MUST change the "Configuration Word Register" bit 5. This register can ONLY be defined once at the time of programming. I think some refer to it as the "FUSE bits" or "configuration fuses" This special register can only be changed each time you program the chip and is not change-able during runtime of your program.
I think I lost a few hairs and much sleep trying to understand the details of configuring PIC's and the registers. I now keep the .pdf of what ever chip I am working with open and refer to it often as I am defining the functionality of my chip and the various I/O pins, analog, comparators, pulse width modulation, etc, etc.
I hope this helps and is not too basic for your level.
In the beginning I tried to use GPIO.3 as a normal input and could not for the life of me figure out why it kept resetting my program...
regards
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
Bookmarks