Greetings,
My project, using a MC9S08LC36, has to drive an LED. The load is 25mA at 2.0V forward voltage. I plan to configure three I/O pins ganged for power, set to High Output. Here are my questions:
* Is this MCU rated for this load. The remaining circuits only add an additional 1mA, so the total load is 26mA. I cannot glean this data from the Freescale book.
* If the MCU can indeed support this load, what is best - To sink or source the load? I prefer to sink to ground as it would provide a convenient means of testing for power to the LED before configuring the three pins for sinking.
Thanks,
KM
Solved! Go to Solution.
Hello Kerry, and welcome to the forum.
Supplying sufficient current for the LED will be easily achieved by paralleling two GPIO outputs. However, the issue may well be the regulation of the current through the LED, so that the brightness does not considerably change with normal variation of supply voltage to the MCU, particularly if operated directly from a battery, without an intervening voltage regulator.
If the specified forward voltage of the LED is 2.0 volts (maybe with a unit-to-unit tolerance above and below this level), and the allowable Vdd range of the MCU is 1.8 - 3.6 volts, you are clearly able to directly operate the LED only nearer the upper end of this range. The LED would not reliably work with a single lithium cell power source (say 2.0 to 3.0 operating range).
If operating from a regulated supply of 3.0 or 3.3 volts, the LED operation should be satisfactory, but may still be subject to significant unit-to-unit variation of current using a fixed series resistor. Tolerances for regulator output voltage, LED forward voltage and GPIO voltage drop would need to be taken into account for worst case calculation.
Assuming the paralleling of two outputs, with nominally 10-12 mA per output, for Vdd of 2.7 volts, the worst case voltage drop is specified 0.5 volts @ 10mA. A typical voltage drop would be about 0.3 volt (see fig. A-2 of the datasheet). I assume that these figures would apply with high drive strength selected at the pin. The datasheet does not seem to be specific on this point.
My personal preference for driving LEDs from GPIO is to sink the LED current to a permanent output low. The LED on/off state is then controlled by switching the GPIO pin between output and input (with pullup enabled) states.
Regards,
Mac
Thanks bigmac,
I am pleased that this MCU will support driving the LED, and I will use sinking as you suggested.
This circuit uses a LM2936DT-3.3V regulator hooked to 12V, along with a current-limiting resistor, so the LED will have steady voltage applied. It also has Lithium batteries for backup. For clarity reasons I did not include this in my post, but your thorough approach identified this as a potential problem.
Thanks again,
KM
Hello Kerry, and welcome to the forum.
Supplying sufficient current for the LED will be easily achieved by paralleling two GPIO outputs. However, the issue may well be the regulation of the current through the LED, so that the brightness does not considerably change with normal variation of supply voltage to the MCU, particularly if operated directly from a battery, without an intervening voltage regulator.
If the specified forward voltage of the LED is 2.0 volts (maybe with a unit-to-unit tolerance above and below this level), and the allowable Vdd range of the MCU is 1.8 - 3.6 volts, you are clearly able to directly operate the LED only nearer the upper end of this range. The LED would not reliably work with a single lithium cell power source (say 2.0 to 3.0 operating range).
If operating from a regulated supply of 3.0 or 3.3 volts, the LED operation should be satisfactory, but may still be subject to significant unit-to-unit variation of current using a fixed series resistor. Tolerances for regulator output voltage, LED forward voltage and GPIO voltage drop would need to be taken into account for worst case calculation.
Assuming the paralleling of two outputs, with nominally 10-12 mA per output, for Vdd of 2.7 volts, the worst case voltage drop is specified 0.5 volts @ 10mA. A typical voltage drop would be about 0.3 volt (see fig. A-2 of the datasheet). I assume that these figures would apply with high drive strength selected at the pin. The datasheet does not seem to be specific on this point.
My personal preference for driving LEDs from GPIO is to sink the LED current to a permanent output low. The LED on/off state is then controlled by switching the GPIO pin between output and input (with pullup enabled) states.
Regards,
Mac