Re: Watching for pin High
actually the "TRIS" statement should have read...
TrisA = %00000011 the "%" indicates the following number is binary
you also need to turn off the comparators by including this statement...
CMCON = %00000111
or
CMCON = 7 if you prefer to work with decimal numbers
I like to show the configuration registers using binary as each bit usually does something different and it is easier for me to interpret my code.
I am not sure of your level of knowledge setting up PIC micro's, but you should read the data sheet (at least parts of it) regarding the particular pins and functions you are trying to set up... for example TABLE 5-2 in the data sheet shows ALL the registers that affect PortA. There you see that CMCON must be configured to turn off the comparators.
It is good to look around the forum and in the wiki section and view and study code examples to see how others set up the registers in order to do certain functions.
That was by far the most difficult thing for me to understand when beginning to work with PIC's.
As far as changing your circut board to include the pull-down resistor... you can also just hook it up externally without modifying your board. Just install a resistor (say 10K ohm) from the pin to ground... then when you touch that pin with +5 volts your code should be able to detect a "1".
If you need more help... do post back here.
good luck
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
Bookmarks