Page 1 of 1
Starting to get frustrated with pin control
Posted: 27 Sep 2010 12:48
by roro36
I'm trying to get the individual pins on my 16f690 to be controlled individually, like turn them on and off when I want. Seems like a stupid question but its not working for me. I can get my LCD working and PWM working, but to get an led to turn on and off on a pin is too hard as is working a button. Please help.
Re: Starting to get frustrated with pin control
Posted: 28 Sep 2010 12:19
by gas
Code: Select all
TRISA=0 //Sets all pins on port A as output
PORTA.F# = 1 //Turn pin # on
Code: Select all
TRISA=1 //Sets all pisn on port A as input
if(PORTA.F#){
//insert code to execute when port A pin # is pressed
}
Simple as that
Perhaps you have to execute:
In order to make the port digital input/output.