LCD i2c - how the lcd should behave right after uploading firmware?

devdev
edited March 2016 in Display & Keyboard

Hello guys,

I think I need some help with configuring my lcd. 

I've connected it to i2c bus, and it appear to communicate right at address of 0x4e. Firmware does not freeze or anything, and communicates with host normally.

Right after turning the power on, backlights off's and lcd shows nothing but blinking cursor. 

Another thing: apparently, there is no definition of i2c backlight enable pin.

I can imagine, that some custom configuration (pages?) is missing, but i cannot find any instructions how to configure those.


Im not using any keyboard/buttons nor encoder yet. I'm just interested in showing some status info (ie. bed temp., extruder temp and so on.)

My board is teensy. (at90usb1287)


One more thing: 

compiling the firmware from the web configuration tool (0.92.8 version) with arduino 1.6.7, some warnings pop ups but code compiles anyway:

c:\temp\build49f8c4240fead11f261f6e38555cc2be.tmp\sketch\ui.cpp: In member function 'void UIDisplay::initialize()':
c:\temp\build49f8c4240fead11f261f6e38555cc2be.tmp\sketch\ui.cpp:902:54: warning: large integer implicitly truncated to unsigned type [-Woverflow]
HAL::i2cWrite(~(UI_DISPLAY_I2C_OUTPUT_PINS & 255));
^
c:\temp\build49f8c4240fead11f261f6e38555cc2be.tmp\sketch\ui.cpp:903:53: warning: large integer implicitly truncated to unsigned type [-Woverflow]
HAL::i2cWrite(~(UI_DISPLAY_I2C_OUTPUT_PINS >> 8));
^
c:\temp\build49f8c4240fead11f261f6e38555cc2be.tmp\sketch\ui.cpp: In member function 'int UIDisplay::okAction(bool)':
c:\temp\build49f8c4240fead11f261f6e38555cc2be.tmp\sketch\ui.cpp:2441:1: warning: control reaches end of non-void function [-Wreturn-type]

thanks for your help.

dev.

Comments

  • If I2C communication works (no hang) you need to configure the pins of your chip correctly to match the hardware wiring. Sounds like some pins are not assigned correctly. Be carefull to use the _BV macro to assign the right pins. e.g. _BV(3) for 4th pin.

    Will check th okAction warning.
  • devdev
    edited March 2016
    thx for Your response.

    Well, I was basing on the script lcdi2ctest fom new liquidCrystal lib for arduino (by malpartida) -> 
    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE)

    and here is my pin configuration (does not work, )

    #define UI_DISPLAY_RS_PIN _BV(2)
    #define UI_DISPLAY_RW_PIN _BV(1)
    #define UI_DISPLAY_ENABLE_PIN _BV(0)
    #define UI_DISPLAY_D0_PIN _BV(4)
    #define UI_DISPLAY_D1_PIN _BV(5)
    #define UI_DISPLAY_D2_PIN _BV(6)
    #define UI_DISPLAY_D3_PIN _BV(7)
    #define UI_DISPLAY_D4_PIN _BV(4)
    #define UI_DISPLAY_D5_PIN _BV(5)
    #define UI_DISPLAY_D6_PIN _BV(6)
    #define UI_DISPLAY_D7_PIN _BV(7) 

    hmm. I have no idea how to configure this via _BV() ...

  • when I included LiquidCrystal_I2C to Repetier.ino

    #include <Wire.h> 
    #include <LiquidCrystal_I2C.h>
    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

    in setup :
    lcd.begin(20, 4);
    lcd.print("test");

    and run the code, i've got "test" on my display...

    That means, the wiring is ok. The only thing possible i the pin mapping in Your lcd library. 
    I'm not sure what you ment by :
    "Be carefull to use the _BV macro to assign the right pins. e.g. _BV(3) for 4th pin."

    thanks and sorry for my lame questions.
  • devdev
    edited March 2016
    ok friends.

    I've solved my issue. 
    Now I understand whar repetier meant saying be carefull.

    I had to draw a map of pins:

    LCD socket -> PCF pin number -> pcf port bit number.

    To get to work your pcf8574T with LCD you have to define real pcf bit number, not pin number.
    In my case it was:

    #define UI_DISPLAY_RS_PIN _BV(0)
    #define UI_DISPLAY_RW_PIN _BV(1)
    #define UI_DISPLAY_ENABLE_PIN _BV(2)
    #define UI_DISPLAY_D0_PIN _BV(4)
    #define UI_DISPLAY_D1_PIN _BV(5)
    #define UI_DISPLAY_D2_PIN _BV(6)
    #define UI_DISPLAY_D3_PIN _BV(7)
    #define UI_DISPLAY_D4_PIN _BV(4)
    #define UI_DISPLAY_D5_PIN _BV(5)
    #define UI_DISPLAY_D6_PIN _BV(6)
    #define UI_DISPLAY_D7_PIN _BV(7) 

    So, admin, please mark this topic as [solved].
    best regards
    dev.
Sign In or Register to comment.