Hi Group,
The schematic below (in ASCII art, please view with Fixed font) shows how my friend connects a switch and an LED to one port, so he can make use the port to read a switch in input mode and then changes the port direction to light up the LED.
My questions are:
- Would this design cause the port to overload and eventually get destroyed if the switch is pressed too long?
- Isn't it advisible to have a diode or resistor added between the switch and the port to prevent the above from happening?
- If 26 LEDs each consuming 15mA, were connected to the PIC, and all were switched ON during startup test for a few seconds. Would this endanger the PIC (say 16F877 as an example)?
- I have seen in schematic examples that 10 LEDs were connected to a
- The PIC datasheet says that each port can source or sink 25mA. Is this the Max current or working current?
Thank you for reading. Any feedback is welcomed.
Merry Christmas and regards.
Allen Bong
VCC | |---o---| .-----------------------. | | | | | \\ o\\ o\\ o | PIC | \\ \\ \\ | | \\. \\. \\. '-----|------|-----|----' sw1o o o | | | |sw2|sw3| o------|-----|---------o | | | o-----|---------|---o | | | o---------|---|---o | | | | | | V -> V -> V -> | | | -LED1 -LED2 -LED3 | | | | | | | | | | | | | | | .-. .-. .-. .-. .-. .-. | | | | | | | | | | | | 220| | 220| |220| | | | | | | | '-' '-' '-' '-' '-' '-' | | | 10k|10k|10k| | | | | | | o------o-----o---------o---o---| | | GND (created by AACircuit v1.28.6 beta 04/19/05