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

Led controlled (On/Off) by a PIC

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



Joined: 01 Jan 2013
Posts: 1

View user's profile Send private message

Led controlled (On/Off) by a PIC
PostPosted: Tue Jan 01, 2013 3:20 pm     Reply with quote

I have a LED whose Anode is connected to a 5V source. I need to switch it On/Off. For the On position, I used output_low command.
What command do I need to switch it Off. Output_high or input_low(high)?
For output_high I'm thinking not to damage my PIC, having 2 sources of 5V.
I'm using a PIC 16F876. Thank you!
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue Jan 01, 2013 9:38 pm     Reply with quote

Hi,

You'll need a current limiting resistor in series with the LED. A 300 ohm
resistor would be a good choice.

To turn On the LED you would use output_low(LED), and to turn Off the LED
you would use output_high(LED).

John
unisaco



Joined: 03 Dec 2012
Posts: 6

View user's profile Send private message Yahoo Messenger

PostPosted: Tue Jan 01, 2013 10:37 pm     Reply with quote

That's popular method when design hardware. It's mean we just control directly turn on LED by 0 level logic (due to low current at I/O port).
You need to use 1 resistor (value: 330 ohm) in series to any pins of LED.
Base on this design:
output_low: LED on
output_high: LED off
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