Go Down

Topic: [Resolved] Problem with LCD after changing the used arduino-pins (Read 1 time) previous topic - next topic

zimbosmurf

Nov 29, 2012, 09:46 pm Last Edit: Dec 12, 2012, 08:12 pm by zimbosmurf Reason: 1
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: [Select]
// 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...

billroy

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

-br

zimbosmurf

#2
Nov 29, 2012, 10:00 pm Last Edit: Nov 29, 2012, 10:02 pm by zimbosmurf Reason: 1
*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?

liudr

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?

zimbosmurf

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! ;)

So - no, I have no trouble actual changing the pins! :)

floresta

#5
Nov 30, 2012, 12:11 am Last Edit: Nov 30, 2012, 12:13 am by floresta Reason: 1
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

zimbosmurf

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!

floresta


Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview