> -----Original Message----- > From: Howard Simpson [SMTP:hjsbra@BIGPOND.COM] > Sent: Monday, January 13, 2003 10:39 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]:Port to LED > > Hi All, > Does anyone see a problem with controlling an LED by applying 12 > volts > to the anode, through an appropriate resistor, to a port, and switching > the LED on with an 0? (4 seven seg displays in this case, multiplexed > one at a time) > I thought that perhaps 12 volts might appear momentarily on the > port, > before the resistor dropped the voltage. > Or, can 12 volts "leak" back through the LED. It shouldn't, but I > have > no way to measure any 12 volt spikes which may cause a problem with the > port. > A bit wierd, I know, but the idea is the PIC runs for hours doing > it's > thing before it's necessary to have a look at the LED display, by > pressing a button and turning it on for a short time. > As it's battery powered, I was hoping to use an efficient switch > mode > regulator to save battery power, and not have to have the regulator > supply a few mA for the PIC, then be required to supply 80 mA or so for > one segment per display from time to time. > The battery is 12 volts because it's huge. This thing is required > to > run for months without charging. I'm looking at 6 volt dry cell > batteries with a switch mode regulator, and same question applies to 6 > volts as it does to 12. (Hmmmm... only have to dump one volt this way > tho!) > The simple answer is no, you cannot usualy do this. The pins of a PIC have protection diodes that are tied to both supply rails. By applying 12v to a pin, these diodes will be biased into conduction and you LED's will be lit irrespective of the state of the PORT ot TRIS registers. The only exception to this is the open collector output on pin RA4 which does not have the diodes. However, the maximum voltage on this pin is quite limited, the 16F877 for example has an absolute maximum voltage of 8.5volts. The bad news is that you will have to use some external components to achieve your goal. The simplest and possibly cheapest would be an open collector buffer such as a 74LS07 which has six buffers per package, can sink up to 30mA per output and is rated up to 30volts. HTH Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= Any questions about Bookham's E-Mail service should be directed to postmaster@bookham.com. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics