Author Topic: On Arduino, digitalWrite LOW = connection to ground? High = short to Vcc?  (Read 3540 times)

0 Members and 1 Guest are viewing this topic.

Offline analogoTopic starter

  • Regular Contributor
  • *
  • Posts: 85
  • Country: at
What happens electrically when I run execute a digitalWrite(PIN1, LOW) on an output pin on an Arduino? Can I think of the pin as being physically shorted to ground?

And what about HIGH? Can I replace the pin in my calculations with a short to Vcc (5v or 3v depending on the model)? Or is there some non-negligible resistor between the pin and the Vcc?
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
When you write the pin to output a 0 or a 1, you are switching a mosfet for that pin, this mosfet has a resistance, and it does vary with temperature and voltage.

If you look on the datasheet it will tell you the maximum current per pin, and maximum per device, sometimes they even tell you the driver resistance, still, never exceed those maximum's, and you should be in the right ballpark for what the pins can safely source or sink.
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Generally speaking the transistor drive to ground can handle more
current than to Vcc with a lower V drop, due to source bulk effect
on threshold for the switch to Vcc.

http://www.egr.msu.edu/classes/ece410/mason/files/Ch7.pdf

http://nptel.ac.in/courses/117101058/downloads/Lec-15.pdf

Also, some controllers have an additional limit, the sum of all currents
into pins on a specific port power domain. Eg. some UPs handle power
on a per port basis.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline analogoTopic starter

  • Regular Contributor
  • *
  • Posts: 85
  • Country: at
http://www.egr.msu.edu/classes/ece410/mason/files/Ch7.pdf

Thank you Dana, the circuit in the first slide was exactly what I was looking for.

BTW, comic sans in the slides of an EE university course?
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
low -> ground voltage
high -> Vcc voltage

But might not be exactly perfect due to switch drop voltage and heating...etc.

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Since we are talking at the beginner level, do not forget to declare the pin as an output. Failing to do so will prevent the pin from latching in the state. The pin will go into a floating state at the next instruction.  The compiler will not warn you when  this is done.  It does have a useful purpose.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf