CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Using Pot to turn LED on/ off

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
solidust



Joined: 08 Mar 2010
Posts: 13

View user's profile Send private message

Using Pot to turn LED on/ off
PostPosted: Sun Mar 21, 2010 2:13 pm     Reply with quote

I am new to programming and I am ready to turn an LED on/ off on RC1 using a 20K pot on RA1.

I am using a 16F74 PIC and CCS 4.3.0.271.

Here is my code thus far but I'm not sure about the next line.
Code:

void main() {

while(true) {

setup_adc_ports(RA1_ANALOG);
set_adc_channel(1);
delay_us(10);
value = read_adc();

Plz help. I searched tru this forum but to no avail.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Mar 21, 2010 3:33 pm     Reply with quote

Look at the code in this thread. After you read the A/D value, compare
it to some number. If the A/D value is greater than the specified number,
then turn on the LED.
http://www.ccsinfo.com/forum/viewtopic.php?t=24750
solidust



Joined: 08 Mar 2010
Posts: 13

View user's profile Send private message

PostPosted: Mon Mar 22, 2010 8:57 pm     Reply with quote

Thanks man you helped me out alot there. Thanks. Blessings.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group