Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Teensy 4.0 and LCD

  1. #1
    Junior Member
    Join Date
    May 2022
    Location
    NE of Seattle
    Posts
    6

    Teensy 4.0 and LCD

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

    }

  2. #2
    3.3V versus 5V?

  3. #3
    Junior Member
    Join Date
    May 2022
    Location
    NE of Seattle
    Posts
    6
    Quote Originally Posted by joepasquariello View Post
    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.

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,779
    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

  5. #5
    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.

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,779
    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....80-circuit.php
    as a reference on which pins go to which...

    Click image for larger version. 

Name:	screenshot.jpg 
Views:	6 
Size:	349.7 KB 
ID:	28357

    And I had to adjust the contrast with the pot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •