LCD 16x2 using pnly the analog pins

Hi everybody, if we use only the analog pins to wire the 16x2 LCD, will it work fine ?
Of course the pin declaration will change accordingly to lets say :

...
LiquidCrystal lcd(14, 15, 16, 17, 18, 19);
...

:~ :~

It will work fine . Just use proper pin declaration : A1 , A2, A3 etc .

It will work fine . Just use proper pin declaration : A1 , A2, A3 etc .

There’s nothing wrong with using 14, 15, 16, 17, 18, 19 as he has indicated.

Don

waski: It will work fine . Just use proper pin declaration : A1 , A2, A3 etc .

Well that's what i mean , Pin 14 is Analog in 0 Pin 15 is Analog in 1 Pin 16 is Analog in 2 Pin 17 is Analog in 3 Pin 18 is Analog in 4 Pin 19 is Analog in 5

so:

...
LiquidCrystal lcd(14, 15, 16, 17, 18, 19);
...

I guess it will work fine ... ?? 8) :drooling_face: :roll_eyes:

Yep, in fact if you have a mini you can use A6 and A7 too.

Aparently these are not part of PORT C and can only be acessed as analog inputs. A0 to A5 (or 14 to 19) can still be used as digital outputs, if required.

casemod: Yep, in fact if you have a mini you can use A6 and A7 too.

I have an Uno , but anyways i only need 6 pins.. Thanks for replying :):):)

Yep, in fact if you have a mini you can use A6 and A7 too.

Are you sure about that?

The folks at Atmel would be interested to learn how you managed to send data out of pins that are designed only for input.

Don

floresta:

Yep, in fact if you have a mini you can use A6 and A7 too.

Are you sure about that?

The folks at Atmel would be interested to learn how you managed to send data out of pins that are designed only for input.

Don

Every analog input can be used as digital output..

floresta:

Yep, in fact if you have a mini you can use A6 and A7 too.

Are you sure about that?

The folks at Atmel would be interested to learn how you managed to send data out of pins that are designed only for input.

Don

You are indeed right.

Every analog input can be used as digital output..

Except for those that are input only.

From datasheet Section 23.1 (Features): . . . • 6 Multiplexed Single Ended Input Channels • 2 Additional Multiplexed Single Ended Input Channels (TQFP and QFN/MLF Package only) . . .

The first six are digital I/O pins, the other two are analog input only.

You can prove your point by identifying where to find the data direction register for the other two pins.

Don

floresta:

Every analog input can be used as digital output…

Except for those that are input only.

From datasheet Section 23.1 (Features):
. . .
• 6 Multiplexed Single Ended Input Channels
• 2 Additional Multiplexed Single Ended Input Channels (TQFP and QFN/MLF Package only)
. . .

The first six are digital I/O pins, the other two are analog input only.

You can prove your point by identifying where to find the data direction register for the other two pins.

Don

As for the Uno, i know A0 to A5 analog inputs can be used as digital outputs too… I guess what you mention above is about the mini right ? :~ :~ :~

Also as i see from the image below

Some PWM output pins are used(3,5,11)… Is that random or they are used by the liquidcrystal library(as PWM)?
That’s why i asked before if it’s gonna work fine if only connected on analogs :~ :~ :~ :~

LCD_bb.png

zaxarias:

floresta:

Every analog input can be used as digital output..

Except for those that are input only.

From datasheet Section 23.1 (Features): . . . • 6 Multiplexed Single Ended Input Channels • 2 Additional Multiplexed Single Ended Input Channels (TQFP and QFN/MLF Package only) . . .

The first six are digital I/O pins, the other two are analog input only.

You can prove your point by identifying where to find the data direction register for the other two pins.

Don

As for the Uno, i know A0 to A5 analog inputs can be used as digital outputs too... I guess what you mention above is about the mini right ? :~ :~ :~

Yes, A6 and A7 are only available on the SMT version of the Atmega328, hence the arduino mini.

Some PWM output pins are used(3,5,11).. Is that random or they are used by the liquidcrystal library(as PWM)? That's why i asked before if it's gonna work fine if only connected on analogs ....

The LCD, and hence the Liquid Crystal library, does not require anything other than standard digital output pins. As a matter of fact you can run one of these displays without a microprocessor - using just a battery and switches.

Any available digital output pin can be connected to any of the LCD pins. Typically you would assign pins with special functions to devices that require those functions and then use the remaining pins for your LCD.

It is the function of the numbers within the argument of the constructor (the string of numbers in parentheses) to tell the Liquid Crystal library which Arduino pin is connected to which LCD pin.

It would all be much clearer if the perpetrators of the library and the authors of the Tutorial had been more liberal with their use of comments:

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here

Don

floresta:

Some PWM output pins are used(3,5,11).. Is that random or they are used by the liquidcrystal library(as PWM)?

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here

[/color]

Don

Really nice answer , thank you ... Neither of those pins (required by the library) require a PWM function so analog pins used as digital will do the job just perfect .. Thanks again :D :D :D :D :grin: :grin: :grin: :grin: :grin: :grin:

what is the syntax for declaring analog pins to be digital ? Is it enough to include in LiquidCrystal lcd(RS, E, D4, D5, D6, D7); BTW according to the header file LiquidCrystal lcd(RS, E, D0, D1, D2, D3); for 4 bit mode.

Thanks

You just specify in the normal way. e.g. 14 or A0.

Personally, I prefer to use A0 because then I do not need to look up what the equivalent "digital" number is.

The library will make sure that the relevant pin is in the correct mode. Just the same as you would if you wanted to connect an LED to an Analog pin e.g. A0 - A5.

Note that A6, A7 on a TQFP-32 mega328P can NOT be used as Digital pins.

David.

jtabatch: BTW according to the header file LiquidCrystal lcd(RS, E, D0, D1, D2, D3); for 4 bit mode.

Yeah, I've seen that and it has existed for quite some time.\ My comment on that is that whoever wrote that deserves to be smacked on the head. I think it is totally foolish and very dumb to use the names D0, D1, D2, D3 for variables to a constructor that are holding the Arduino pin numbers that are connected to LCD signals D4, D5, D6, D7

--- bill

You could be using only A4 and A5 with an I2C backpack. :)