After reading the app notes and searching some forums I got my program to work by adding some initilization strings at the begining. I'm not sure if all of them are needed however most of them are required to get the pins to function as I want (digital I/O). Now that I am aware of the need for them I can experiement and determine how and when to best utilize them. The final code I used for this experiment is below:
Ansel=%00000000 ;sets a/d pins to digital
Cmcon0=%00000111 ; sets comparator pins to digital
Adcon1=%00000111 ;sets a/d pins to digital
Trisa=%11111110 ;sets all porta pins (except 0) to inputs
MAIN:
PinCheck:
if PortA.1 then delay
High 0 ' Turn on LED connected to PORTB.0
Pause 100
Low 0 ' Turn off LED connected to PORTB.0
Pause 100
Goto main
delay:
high 0
pause 1000
low 0
pause 1000
goto pincheck
End
The program works as expected except that at present the program always enters the delay routeen and will use the main routeen when pin 1 is pulled low. I will examine the documents for pin one to see if there is an enternal pull-up resistor that needs to be switched off, otherwise I can correct the operation of the circuit by adding a pull-down resistor at pin 1 so that closing a switch forces pin 1 high. I know this is pretty basic stuff to most of you out there but hope that someone finds this post useful.
Posted on: February 22, 2008, 06:05:14 18:05 - Automerged
Thanks for the post! That forum content that you posted was one of the areas that I found and help set me on the right track. Thanks for your help!