Shop OBEX P1 Docs P2 Docs Learn Events
ON/OFF button for PIC16f877a (ambiguity) — Parallax Forums

ON/OFF button for PIC16f877a (ambiguity)

iriliasirilias Posts: 3
edited 2012-08-23 08:40 in Learn with BlocklyProp
Hi, I'm very new to microcontrollers and i need an ON/OFF button for my sphygmomanometer project to turn it off and on and i don't know if i did the wiring of the pic the right way or
not ?

Sans titre.JPG



if it's correct, does turning ON & OFF the pic (the way i wired it) could make any firmware glitches or some other problems ? , i'm using pic16f877a ..
i'm new at this so please bear with me (and excuse my poor english,it's not my native language).. any help at all would be much appreciated, thanks in advance .
368 x 504 - 16K

Comments

  • SRLMSRLM Posts: 5,045
    edited 2012-08-21 11:34
    Hello, this is not the correct forum for questions about the Pic line of microcontrollers. These forums are for Parallax brand microcontrollers. You might have better luck at http://www.microchip.com/forums/ or https://forum.sparkfun.com/viewforum.php?f=4

    As a side note, I would say no, your circuit is not correct. When the button is pressed, it shorts VCC to VDD, and otherwise leaves VDD floating. Alltogether, it doesn't look correct. I would suggest looking at the Pic datasheet for some example circuits.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-21 12:23
    You may have corrected your diagram. What I see with a 1:26pm time on it looks like a correct on/off switch. When the switch is closed and stays closed, the microcontroller turns on and goes through a reset cycle. When the switch is opened, the microcontroller immediately turns off no matter what it's doing. Like most switches, your on/off switch probably bounces a bit. Usually the reset cycle takes a little time, often more than the bounces, so this bouncing may not affect the microcontroller. When the switch is turned off, the switch will also be bouncing, but the microcontroller will be trying to complete a reset cycle and will not likely complete that before the switch stops bouncing.

    If you have sensors attached to your microcontroller and these are not running off the microcontroller Vdd / Vss lines, you can damage the microcontroller if the sensors are powered when the microcontroller is not powered.

    This sort of thing applies to any microcontroller including the Stamps and the Propeller. The Stamp module has a filter capacitor across the Vdd / Vss power lines which would avoid the bouncing issue.
  • iriliasirilias Posts: 3
    edited 2012-08-22 08:01
    Oh, thank you very much for your replies, and i sincerely apologize for posting here…i know better and i should have checked around ..and next time i will be more careful before posting anything...

    yes Mr. Green i do have an MPX2050 piezoresistive pressure sensor (supplied 10V) attached to the MCU through some AOPs (supplied 5V each) the AD620 and OPA2277.. could that make a problem ? considering the way i wired the ON/OFF switch ?

    Sans titre1.jpg
    Sans titre2.JPG

    and also a 6v electro-valve ?! should i make any changes ?.. thank you so much in advance
    1024 x 411 - 30K
    887 x 556 - 30K
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-22 10:36
    Any time you have a device like a microcontroller that has a separate power supply from other devices connected to it and the power supplies are turned on and off at different times, you can have a problem. If you look at the datasheet for pretty much any microcontroller, you'll see that the I/O pins have a maximum voltage that can be supplied to them that's usually 0.3V above the supply voltage for the microcontroller (Vdd+0.3V). If you turn off the supply to the microcontroller, Vdd will be zero and a sensor that still has power will usually provide a voltage greater than 0.3V to the I/O pin. That can destroy the I/O pin circuitry if any significant amount of current is allowed to flow (sometimes with less than 1mA).

    The easiest solution is to have all your power sources derived from the same power supply and to turn that on and off.
  • iriliasirilias Posts: 3
    edited 2012-08-23 08:40
    Thank you for your reply sir, i was thinking of using an ATX power supply to power the whole project .. and turn it ON/OFF as needed from the back (switch behind the power supply) .
Sign In or Register to comment.