@TheBypasser There's been a while since I did any pic programming, but as I recall, there are internal pull-ups on some of the pins. However, they can be to weak in certain applications. When the pins are left not tied to either ground or VDD, they are easily stimulated by any electromagnetic field e.g the presence of your hand hovering above it.
@quietsounds Interesting! Why I asked is because the AVR MCUs I work with all have internal optional 1kOhm pull-up on every pin, one can be enabled if needed by simply writing 1 to the corresponding PORTxN bit while the DDRxN bit is set to 0 (input pin mode); if both PORTxN and DDRxN are set to 0 the pin acts as a high-impedance input. 1k is more then enough so whenever you need some sort of a mechanic or optocoupled switch in your device, you can just rig it pin-to-pin, with no additional parts
Yes! I asked a question about this problem on a forum, and they gave me the same solution. As I am using the pins in IN-LOW mode, i mounted pull-up resistors to VDD +5V and of course it worked right away! Thanks for the tip! No more "loose ends" for me in the future...:-)
You have forgotten to mount pull-down resistors. One resistor at each input-pin down to GND will do it! choose something between 10kΩ up to 100kΩ and it will fix your problem.
Looking forward to try a PIC - according to the comments, there are no internal controlled pull-ups in PIC chips, unlike an AVR, yep?
TheBypasser 1 year ago
@TheBypasser There's been a while since I did any pic programming, but as I recall, there are internal pull-ups on some of the pins. However, they can be to weak in certain applications. When the pins are left not tied to either ground or VDD, they are easily stimulated by any electromagnetic field e.g the presence of your hand hovering above it.
quietsounds 1 year ago
@quietsounds Interesting! Why I asked is because the AVR MCUs I work with all have internal optional 1kOhm pull-up on every pin, one can be enabled if needed by simply writing 1 to the corresponding PORTxN bit while the DDRxN bit is set to 0 (input pin mode); if both PORTxN and DDRxN are set to 0 the pin acts as a high-impedance input. 1k is more then enough so whenever you need some sort of a mechanic or optocoupled switch in your device, you can just rig it pin-to-pin, with no additional parts
TheBypasser 1 year ago
Yes! I asked a question about this problem on a forum, and they gave me the same solution. As I am using the pins in IN-LOW mode, i mounted pull-up resistors to VDD +5V and of course it worked right away! Thanks for the tip! No more "loose ends" for me in the future...:-)
quietsounds 2 years ago
You have forgotten to mount pull-down resistors. One resistor at each input-pin down to GND will do it! choose something between 10kΩ up to 100kΩ and it will fix your problem.
yeshe66 2 years ago