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
Posted: Tue Jan 01, 2013 9:38 pm
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
Posted: Tue Jan 01, 2013 10:37 pm
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
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