Pages: [1]   Go Down
Author Topic: [Resolved] Problem with LCD after changing the used arduino-pins  (Read 1299 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I have a REALLY strange problem:

NEW INFO: I use an Arduino Uno R3

I made a makeshift-arduino-shield from a prototype-board that connects to a serial LCD using a 2x5-crimp-on-header on a ribbon-cable. I used the following pin-connections:
Arduino    LCD
12           RS
11           Enable
5            D4
4            D5
3            D6
2            D7

I initalized the display using
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
and everything worked perfect!

Then I wanted to write a programm that uses external Interrupts, so I needed the arduino-pins 2 and 3, so I made a new shield with the following wiring:

Arduino    LCD
0            RS
1            Enable
4            D4
5            D5
6            D6
7            D7

I initialize the display using
LiquidCrystal lcd(0, 1, 4, 5, 6, 7);

The new wiring is not double-, not triple- but quadruplechecked - everything is correct!
Still - I have nothing on my display...contrast-setting is the same.

In this simple code I can change the commented LiquidCrystal-Line and use the old shield - and everything works. But using the new shield with the corresponding LiquidCrystal-Line, no Display!
Code:
// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(0, 1, 4, 5, 6, 7);
// LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//LiquidCrystal(rs, enable, d4(11), d5(12), d6(13), d7 (14))

void setup(){
  // set up the LCD's number of columns and rows:
  lcd.begin(20, 4);
  // set up Serial Connection
  Serial.begin(9600);
};

void loop()
{
  // initialize LCD
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Speed:");
  lcd.setCursor(0,1);
  lcd.print("Avg:");
  lcd.setCursor(20,0);
  lcd.print("Way:");
  lcd.setCursor(20,1);
  lcd.print("Max-Spd.:");
};

I have no idea why it doesn't work...the only thing I can think of is the fact that pin 0 and 1 are labelled as RX and TX as well...could it be that I can't use these pins for the display or only use them under special circumstances?

I'm completely clueless...
« Last Edit: December 12, 2012, 02:12:04 pm by zimbosmurf » Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your speculation is correct: RX and TX are dedicated to the serial port.

-br
Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

*gnarf* Thanks for your confirmation...

So these pins are used for the connection to the usb2serial-Interface and there's no way to use these in a sketch at all?
« Last Edit: November 29, 2012, 04:02:52 pm by zimbosmurf » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You are strongly suggested to use pins 0 and 1 only for serial port communication with you computer or another serial device. Trying to use it to drive an LCD is not the best choice. Did you run out of pins or something? Have you used the analog pins as digital pins?
Logged


Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, I didn't run out of pins, I'm just at my girlfriends' house at the moment and I don't have a solderingiron here - so I can't change the pinning today - but I'm not willing to wait until tomorrow! smiley-wink

So - no, I have no trouble actual changing the pins! smiley
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
could it be that I can't use these pins for the display or only use them under special circumstances?
You can use them as long as you don't intend to use the serial monitor and as long as whatever you plan to use them with does not affect the uploading of your program.

Quote
so I can't change the pinning today -
You don't appear to be using the serial monitor so you should be able to get rid of it's initialization.  Then remove your LCD shield, upload your program, reattach the shield and your LCD should work.

Don
« Last Edit: November 29, 2012, 06:13:18 pm by floresta » Logged

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

Thanks for the help and sorry that I didn't reply earlier...

The Serial.open in the sketch above isn't necessary, i just used it for debug-information on my computer...

Rewiring the shield worked just fine and everything works now...thanks!
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for the update.

Don
Logged

Pages: [1]   Go Up
Jump to: