Starting to get frustrated with pin control

General discussion on mikroC.
Post Reply
Author
Message
roro36
Posts: 9
Joined: 21 Sep 2010 08:10

Starting to get frustrated with pin control

#1 Post by roro36 » 27 Sep 2010 12:48

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.

gas
Posts: 18
Joined: 17 Aug 2010 06:12
Location: Denmark
Contact:

Re: Starting to get frustrated with pin control

#2 Post by gas » 28 Sep 2010 12:19

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:

Code: Select all

ANSEL = 0
In order to make the port digital input/output.
- Tommy S.
Industrial Automation

Post Reply

Return to “mikroC General”