Pages: [1]   Go Down
Author Topic: PORTC  (Read 768 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 267
dinosaur cork
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there any way in the Arduino language to access the analog pins as digital pins, or does this require using AVR calls. (e.g. DDRC =oxFF)  ?

Is this documented anywhere except in the Port Maniuplation docs? I poked around a bit and didn't see it.


Is there any reason why the analog pins couldn't be defined somehow to allow pinMode and digitalWrite to work with them.
Either as 14 through 19 or maybe ANALOG0, ANALOG1  etc.

I realize there is an interest in extending Arduino to other chips, so some thought would be in order to make the names generic enough.

PB
« Last Edit: October 11, 2007, 08:02:19 am by paulb » Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I like this idea.  Mostly I was just wondering what to call them: ANALOG0, A0, AI0, ANALOGINPUT0, ANALOG_INPUT0...  Any preferences anyone?

At the moment, you can actually pass numbers 14 to 19 to the digital i/o functions, but I don't want to document the feature until we come up with the final names for the pins.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 267
dinosaur cork
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I like the idea of undocumented features. It's the Arduino way. Sorry about the sarcasm - it's only Mild sarcasm.

I thought A0, A1 were already defined as 0, 1, etc from maybe Wiring port variables - A0, A1 etc seems like the easiest thing, but something to avoid because of future compatibility with other chips (when Arduino becomes truly open-source and takes over the world) oops sorry about that. Been talking to chief heretic Jolliffe too much.

I'd vote for ANALOG0 etc. It is a big differentiation between the digital pins. ANALOGINPUT0 generates cognitive dissonance when the pin isn't an input anymore.

When can I write the docs. Thousands of inquiring minds (OK at least 10) want to know. Also if the pins are already defined as 14-19, shouldn't that be in the docs so people can try and figure out why their project goes haywire when they put a variable in the digitalWrite param and it gets out of range?

Or should 14-19 defs go away when the other scheme gets implemented?

Do you know if PORTC has pullups?  These could get in the way of some high-impedance analog circuits one could imagine.



PB

« Last Edit: October 11, 2007, 12:24:47 pm by paulb » Logged

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

Datasheet ATmega48/88/168
Quote
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit)
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Aren't the port variables PA0, PA1, etc?  Or am I misremembering?  In that case, we could use A0, A1, etc.
Logged

Denver, CO
Offline Offline
Jr. Member
**
Karma: 0
Posts: 85
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My $00.02: I like A0, A1... just because thats the notation Ive been using on my own pcbs. Plus its less to type! I would just be concerned about future compatibility as Im still holding out on the day we can have some form of the arduino mojo on an ATTiny...

-B
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What do the ATtiny's use A0, etc. for?
Logged

Pages: [1]   Go Up
Jump to: