Today one of our mentors remarked on our fund raising drag racer VEX robots, and how they had LED’s to report the time in binary. He said you shouldn’t put an LED in the I/O without a resistor on it, as it’s not meant to drive a load, and could damage the microcontroller. I’ve never had a problem, but I do believe there could be merit to this. I thought the VEX had safeguard resistors on the GPIO bank to keep that from happening. And the signal pins don’t even operate on the full 5v. Any opinions?
That brings me to my next question. What about the LED’s that VEX sells on their website? There are no VEX resistors. And if there were, they would have to change their competition rules in order to use them, because you currently cannot modify any electrical components at all, in any way. I can’t see if there is a resistor on there or not, but I would really guess that there’s not, seeing as there are only two wires. If you were to use a resistor on the signal line, I doubt you’d be able to get one that would supply enough power for the LED to still light, so you’d end up having to use a transistor in there too to shunt power from the +5v bar.
Although the Vex Controller provides the 1K Ohm resistors internally and you can directly connect LEDs to the Vex Controller’s outputs as long as you make sure the Cathode is connected to ground, in other microcontroller’s this is not an option since they don’t usually provide these resistors for the outputs and would burn them out.
I use either 200 Ohm or 470 Ohm networked resistors (DIP) from Digikey to drive the RadioShack LED bar with the Vex Controller and they light up just fine. This brings the total resistance Rt = 1000 + 470 to 1470 Ohms, which is still fine to drive an LED.
The schematic you linked to is true for input as well as output. In other words, switching to an output doesn’t bypass the 1K current-limit resistor.
This design allows you to short-circuit any of the I/O ports directly to ground or +5V without causing any excessive currents that could damage the PIC.
It is safe to directly drive a typical LED from a Vex digital output port since the 1K resistor sets an absolute limit of 5mA; the most I’ve ever measured was 4.63mA. High-brightness LEDs may not be able to light well with this low current.