Teensy 4.0 and LCD

JimF

Member
I cannot get a 20x2 lcd to work with a Teensy 4.0. What am I missing? I used the same wiring and software on an Arduino Mega and it worked just fine. So I move the wires over to a Teensy 4.0 and I get nothing. Simple stupid program used just to make sure the lcd works ok. Any suggestions would be greatly appreciated.


#include <LiquidCrystal.h>


// initialize the LCD with the numbers of the interface pins
LiquidCrystal lcd(2,3,4,5,6,7,8);

void setup() {

lcd.begin(20,2); // set up the LCD's number of columns and rows:
lcd.print("Collins Digital"); //Sign on
lcd.setCursor(0,1);
lcd.print("Display/Gen");
delay(2000);
lcd.clear();
lcd.print("Jim, K7NCG");
lcd.setCursor(0,1);
lcd.print("1/10/2021");
delay(2000);
lcd.clear();

}

void loop() {

lcd.print("Collins Digital"); //Sign on
lcd.setCursor(0,1);
lcd.print("Display/Gen");
delay(2000);
lcd.clear();
lcd.print("Jim, K7NCG");
lcd.setCursor(0,1);
lcd.print("1/10/2021");
delay(2000);
lcd.clear();

}
 
3.3V versus 5V?

I don't think that is the issue. I have the exact same configuration on a Teensy 3.6 and it works quite well. Since 3.6 versions are not available, I'm trying to move over to a later version. Not having much luck so far though. Thanks for the thought.
 
Sorry, I have not used these forms of displays for a long time.

So question is what display, what are connections, and which library are you using?
Yes I know LiquidCrystal, but is it the one that is contained in the Teensyduino release or some other version.
What version of Arduino/Teensyduino?


If similar to one in Teensyduino and no real hints in code above, I am assuming that it is using the constructor:
Code:
  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
		uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);

So 4 data bits and RS, RW and enable.

Looks like the current Beta Teensyduino has version 1.0.7 which I think is the current version.

I would check the version...

Again assuming not voltage as was mentioned. The next likely thing might be timing. That is the Teensy 4 runs a ton faster than Mega (or 3.6).

If using older version of library, try newer version...

Not sure if I have one in my parts bin, but will look
 
Next step I would say is to show your wiring, provide info on the specific display, and specify your Arduino and TeensyDuino versions. If not the latest, that's always a good step to take so that others can replicate your setup exactly. If you haven't tried running any of the examples in TeensyDuino, that might be helpful. Another thought is that something is too fast with T4.0? Quick test with reducing CPU frequency to 150 MHz might be worth a try.
 
Hello again @JimF

Any success?

Just for the heck of it I ordered a couple of cheap displays: https://smile.amazon.com/dp/B079M3GWFG

Which I picked up at my mailbox this morning, soldered some pins in.... And used Micromod instead of T4, but should not not make much of a difference.
The only edit I did to your sketch was to change 20 to 16 ...

Code:
#include <LiquidCrystal.h>


// initialize the LCD with the numbers of the interface pins
LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8);

void setup() {

  lcd.begin(16, 2); // set up the LCD's number of columns and rows:
  lcd.print("Collins Digital"); //Sign on
  lcd.setCursor(0, 1);
  lcd.print("Display/Gen");
  delay(2000);
  lcd.clear();
  lcd.print("Jim, K7NCG");
  lcd.setCursor(0, 1);
  lcd.print("1/10/2021");
  delay(2000);
  lcd.clear();

}

void loop() {

  lcd.print("Collins Digital"); //Sign on
  lcd.setCursor(0, 1);
  lcd.print("Display/Gen");
  delay(2000);
  lcd.clear();
  lcd.print("Jim, K7NCG");
  lcd.setCursor(0, 1);
  lcd.print("1/10/2021");
  delay(2000);
  lcd.clear();

}

Not sure if it mattered but I am using: Arduino library manager LiquidCrystal, which I think is the same as the Teensy install.
Code:
 Used: C:\Users\kurte\Documents\Arduino\libraries\LiquidCrystal
 Not used: C:\arduino-1.8.19\libraries\LiquidCrystal
 Not used: C:\arduino-1.8.19\hardware\teensy\avr\libraries\LiquidCrystal
Using library LiquidCrystal at version 1.0.7 in folder: C:\Users\kurte\Documents\Arduino\libraries\LiquidCrystal

I used http://www.learningaboutelectronics.com/Articles/Arduino-HD44780-circuit.php
as a reference on which pins go to which...

screenshot.jpg

And I had to adjust the contrast with the pot.
 
Back
Top