Pages: [1]   Go Down
Author Topic: Correction: Reference -> PortManipulation  (Read 1012 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This page:  http://www.arduino.cc/en/Reference/PortManipulation

Has a section that includes:
  //See the bitwise operators reference pages and The Bitmath Tutorial in the Playground

  PORTB is the register for the state of the outputs. For example;

  PORTD = B10101000; // sets digital pins 7,5,3 HIGH

  You will only see 5 volts on these pins however if the pins have been set as outputs using the DDRD register or with pinMode().
 
  PINB is the input register variable It will read all of the digital input pins at the same time.


It might be more clear if the PORTB reference was changed to PORTD and PINB was changed to PIND.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This page:  http://www.arduino.cc/en/Reference/PortManipulation

Has a section that includes:
  //See the bitwise operators reference pages and The Bitmath Tutorial in the Playground

  PORTB is the register for the state of the outputs. For example;

  PORTD = B10101000; // sets digital pins 7,5,3 HIGH

  You will only see 5 volts on these pins however if the pins have been set as outputs using the DDRD register or with pinMode().

No, you will then see +5vdc on those pins that are set to 1 in the PORTD register as that will enable the internal pull-up resistor for that pin while in input mode. However it will not be able to source very much current at all as it's like a 40K value resistance, but a meter will read +5vdc even in input mode. The pins set to 0 while in input mode will be floating and the meter reading will be misleading or invalid at best.

Lefty

 
  PINB is the input register variable It will read all of the digital input pins at the same time.


It might be more clear if the PORTB reference was changed to PORTD and PINB was changed to PIND.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Retrolefty,

I am new to this forum.  Are you adding another correction to the same page, then?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Retrolefty,

I am new to this forum.  Are you adding another correction to the same page, then?

No, I'm not the author of that page nor due I know how to edit it.

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Lefty,

Sorry, i am confused.  Are you offering a correction to the correction I suggested?

The note you added is before my suggestion ( see the very last sentence ).  I can't tell if my suggestion is in error or if you are also correcting the same page I am, for a different issue.

If you click on the link I provided, you will see the note you have added would be a correction for the original page.  I didn't write the voltage stuff, it is already there.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Lefty,

Sorry, i am confused.  Are you offering a correction to the correction I suggested?

The note you added is before my suggestion ( see the very last sentence ).  I can't tell if my suggestion is in error or if you are also correcting the same page I am, for a different issue.

If you click on the link I provided, you will see the note you have added would be a correction for the original page.  I didn't write the voltage stuff, it is already there.

Well then just disregard it. The point I was making is it is possible to read +5vdc output voltage on an INPUT pin if the pin has it's internal pull-up resistor enabled, which would happen if you write a corresponding 1 bit into the PORTx register.

Lefty
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think bhedrick is referring to the fact that the documentation swaps to and fro from B to D when referring to the various PORT and PIN registers.

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Pages: [1]   Go Up
Jump to: