20x4 LCD with repetier 9.2 and megatronics 3.0

Hello,

i have a 20x4 lcd (http://elecfreaks.com/store/download/datasheet/lcd/Char/JN2004A.PDF) and i have to connect this to the megatronics v3.0 where i have the repetier firmware. I have connect the lcd pin to the lcd like this:


image

and change the pin assignement in the uiconfig.h with:

#define UI_DISPLAY_TYPE 1

#define UI_COLS 20
#define UI_ROWS 4

#else // Direct display connections
#define UI_DISPLAY_RS_PIN D_D14 // PINK.1, 88, D_RS
#define UI_DISPLAY_RW_PIN -1
#define UI_DISPLAY_ENABLE_PIN  D_D15 // PINK.3, 86, D_E
#define UI_DISPLAY_D0_PIN -1 // PINF.5, 92, D_D4
#define UI_DISPLAY_D1_PIN -1 // PINK.2, 87, D_D5
#define UI_DISPLAY_D2_PIN -1 // PINL.5, 40, D_D6
#define UI_DISPLAY_D3_PIN -1 // PINK.4, 85, D_D7
#define UI_DISPLAY_D4_PIN D_D30 // PINF.5, 92, D_D4
#define UI_DISPLAY_D5_PIN D_D31 // PINK.2, 87, D_D5
#define UI_DISPLAY_D6_PIN D_D32 // PINL.5, 40, D_D6
#define UI_DISPLAY_D7_PIN D_D33 // PINK.4, 85, D_D7
#define UI_DELAYPERCHAR   50

but the lcd not show anything. 
Can you help me?

Thanks

Comments

  • Pin names are wrong. Simply write 30 for D_D30 and so on.
  • Also with latest Arduino IDEs you need to remove comments after number!
  • Hello, 

    i have tried but don't work .... The pins that i use are this:

    LCD LCD Header (2x6 header) 
    1. GND 
    2. 5V 
    3. LCD Contrast 
    4. D32 
    5. GND 
    6. D31 
    7. D14 
    8. D30 
    9. D39 
    10. D15 
    11. 5V 
    12. GND 

    but nothing happen. The pins are so defined:

    #else // Direct display connections
    #define UI_DISPLAY_RS_PIN 14
    #define UI_DISPLAY_RW_PIN -1
    #define UI_DISPLAY_ENABLE_PIN        15
    #define UI_DISPLAY_D0_PIN -1
    #define UI_DISPLAY_D1_PIN -1
    #define UI_DISPLAY_D2_PIN -1
    #define UI_DISPLAY_D3_PIN -1
    #define UI_DISPLAY_D4_PIN 30
    #define UI_DISPLAY_D5_PIN 31
    #define UI_DISPLAY_D6_PIN 32
    #define UI_DISPLAY_D7_PIN 33
    #define UI_DELAYPERCHAR   50
  • Have you set feature controller to use your uiconfig at all? Normally it is off or set to a special display and in these cases uiconfig.h is ignored.
  • I have check the pin and are correct... 

    I have this uiconfig.h but not work:

    #ifndef _ui_config_h
    #define _ui_config_h

    /** While the ascii chars are all the same, the driver have different charsets
    for special chars used in different countries. The charset allows to fix for
    this problem. If characters look wrong, try a different charset. If nothing
    works, use the ascii charset 0 as fallback. Not the nicest for everything but working!

    0 = ASCII fallback
    1 = Default works on most displays. This has some japanese chars in charset
    2 = Alternative charset with more european chars

    */
    #define UI_DISPLAY_CHARSET 1

    /** Select type of beeper
    0 = none
    1 = Piezo connected to pin
    2 = Piezo connected to a pin over I2C
    */
    #ifndef BEEPER_TYPE
    #define BEEPER_TYPE 1
    #define BEEPER_TYPE_INVERTING false

    #if BEEPER_TYPE==1 && !defined(BEEPER_PIN)
    #define BEEPER_PIN 37
    #if BEEPER_TYPE==2
    #define BEEPER_ADDRESS 0x40 // I2C address of the chip with the beeper pin
    #define BEEPER_PIN _BV(7)  // Bit value for pin 8
    #define COMPILE_I2C_DRIVER  // We need the I2C driver as we are using i2c


    /**
    What display type do you use?
    0 = No display - do not use here. Set FEATURE_CONTROLLER 0 instead
    1 = LCD Display with 4 bit data bus
    2 = LCD Display with 8 bit data bus (currently not implemented, fallback to 1)
    3 = LCD Display with I2C connection, 4 bit mode
    4 = Use the slower LiquiedCrystal library bundled with arduino.
        IMPORTANT: You need to uncomment the LiquidCrystal include in Repetier.pde for it to work.
                   If you have Sanguino and want to use the library, you need to have Arduino 023 or older. (13.04.2012)
    5 = U8G supported display
    */
    #define UI_DISPLAY_TYPE 1

    #if UI_DISPLAY_TYPE == DISPLAY_U8G // Special case for graphic displays

    // You need to define which controller you use and set pins accodringly

    // For software spi assign these definitions
    // SCK Pin:  UI_DISPLAY_D4_PIN
    // Mosi Pin: UI_DISPLAY_ENABLE_PIN
    // CD Pin:   UI_DISPLAY_RS_PIN

    // ST7920 with software SPI
    //#define U8GLIB_ST7920
    // SSD1306 with software SPI
    //#define U8GLIB_SSD1306_SW_SPI
    // SH1106 with software SPI
    // U8GLIB_SH1106_SW_SPI
    // SSD1306 over I2C using hardware I2C pins
    //#define U8GLIB_SSD1306_I2C
    // For the 8 bit ks0108 display you need to set these pins
    // UI_DISPLAY_D0_PIN,UI_DISPLAY_D1_PIN,UI_DISPLAY_D2_PIN,UI_DISPLAY_D3_PIN,UI_DISPLAY_D4_PIN,UI_DISPLAY_D5_PIN,UI_DISPLAY_D6_PIN,UI_DISPLAY_D7_PIN
    // UI_DISPLAY_ENABLE_PIN,UI_DISPLAY_CS1,UI_DISPLAY_CS2,
    // UI_DISPLAY_DI,UI_DISPLAY_RW_PIN,UI_DISPLAY_RESET_PIN
    //#define U8GLIB_KS0108
    //#define U8GLIB_KS0108_FAST
    // UI_DISPLAY_RS_PIN = CS
    // UI_DISPLAY_D5_PIN = A0
    //#define U8GLIB_ST7565_NHD_C2832_HW_SPI

    #define UI_LCD_WIDTH 128
    #define UI_LCD_HEIGHT 64

    //select font size
    #define UI_FONT_6X10 //default font
    #ifdef UI_FONT_6X10
    #define UI_FONT_WIDTH 6
    #define UI_FONT_HEIGHT 10
    #define UI_FONT_SMALL_HEIGHT 7
    #define UI_FONT_DEFAULT repetier_6x10
    #define UI_FONT_SMALL repetier_5x7
    #define UI_FONT_SMALL_WIDTH 5 //smaller font for status display
    #define UI_ANIMATION false  // Animations are too slow

    //calculate rows and cols available with current font
    #define UI_COLS (UI_LCD_WIDTH/UI_FONT_WIDTH)
    #define UI_ROWS (UI_LCD_HEIGHT/UI_FONT_HEIGHT)
    #define UI_DISPLAY_CHARSET 3
    /** Number of columns per row
    Typical values are 16 and 20
    */
    #define UI_COLS 20
    /**
    Rows of your display. 2 or 4
    */
    #define UI_ROWS 4
    #endif // UI_DISPLAY_TYPE

    /* What type of chip is used for I2C communication
    0 : PCF8574 or PCF8574A or compatible chips.
    1 : MCP23017
    */
    #define UI_DISPLAY_I2C_CHIPTYPE 0
    // 0x40 till 0x4e for PCF8574, 0x40 for the adafruid RGB shield, 0x40 - 0x4e for MCP23017
    // Official addresses have a value half as high!
    #define UI_DISPLAY_I2C_ADDRESS 0x4e
    // For MCP 23017 define which pins should be output
    #define UI_DISPLAY_I2C_OUTPUT_PINS 65504
    // Set the output mask that is or'd over the output data. This is needed to activate
    // a backlight switched over the I2C.
    // The adafruit RGB shields enables a light if the bit is not set. Bits 6-8 are used for backlight.
    #define UI_DISPLAY_I2C_OUTPUT_START_MASK 0
    // For MCP which inputs are with pullup. 31 = pins 0-4 for adafruid rgb shield buttons
    #define UI_DISPLAY_I2C_PULLUP 31
    /* How fast should the I2C clock go. The PCF8574 work only with the lowest setting 100000.
    A MCP23017 can run also with 400000 Hz */
    #define UI_I2C_CLOCKSPEED 100000L
    /**
    Define the pin
    */
    #if UI_DISPLAY_TYPE == DISPLAY_I2C // I2C Pin configuration
    #define UI_DISPLAY_RS_PIN 14
    #define UI_DISPLAY_RW_PIN -1
    #define UI_DISPLAY_ENABLE_PIN 15
    #define UI_DISPLAY_D0_PIN -1
    #define UI_DISPLAY_D1_PIN -1
    #define UI_DISPLAY_D2_PIN -1
    #define UI_DISPLAY_D3_PIN -1
    #define UI_DISPLAY_D4_PIN 30
    #define UI_DISPLAY_D5_PIN 31
    #define UI_DISPLAY_D6_PIN 32
    #define UI_DISPLAY_D7_PIN 33

    // uncomment if your using led to indicated the bed is hot
    //#define UI_I2C_HEATBED_LED    _BV(8)

    // uncomment if your using led to indicated the extruder is hot
    //#define UI_I2C_HOTEND_LED     _BV(7)

    // uncomment if your using led to indicated the FAN is on
    //#define UI_I2C_FAN_LED        _BV(6)

    // Pins for adafruid RGB shield
    /*#define UI_DISPLAY_RS_PIN _BV(15)
    #define UI_DISPLAY_RW_PIN _BV(14)
    #define UI_DISPLAY_ENABLE_PIN _BV(13)
    #define UI_DISPLAY_D0_PIN _BV(12)
    #define UI_DISPLAY_D1_PIN _BV(11)
    #define UI_DISPLAY_D2_PIN _BV(10)
    #define UI_DISPLAY_D3_PIN _BV(9)
    #define UI_DISPLAY_D4_PIN _BV(12)
    #define UI_DISPLAY_D5_PIN _BV(11)
    #define UI_DISPLAY_D6_PIN _BV(10)
    #define UI_DISPLAY_D7_PIN _BV(9)*/

    #else // Direct display connections
    #define UI_DISPLAY_RS_PIN 14 // PINK.1, 88, D_RS
    #define UI_DISPLAY_RW_PIN -1
    #define UI_DISPLAY_ENABLE_PIN        15 // PINK.3, 86, D_E
    #define UI_DISPLAY_D0_PIN -1 // PINF.5, 92, D_D4
    #define UI_DISPLAY_D1_PIN -1 // PINK.2, 87, D_D5
    #define UI_DISPLAY_D2_PIN -1 // PINL.5, 40, D_D6
    #define UI_DISPLAY_D3_PIN -1 // PINK.4, 85, D_D7
    #define UI_DISPLAY_D4_PIN 30 // PINF.5, 92, D_D4
    #define UI_DISPLAY_D5_PIN 31 // PINK.2, 87, D_D5
    #define UI_DISPLAY_D6_PIN 32 // PINL.5, 40, D_D6
    #define UI_DISPLAY_D7_PIN 33 // PINK.4, 85, D_D7
    #define UI_DELAYPERCHAR   50

    // Special pins for some u8g driven display

    #define UI_DISPLAY_CS1 59
    #define UI_DISPLAY_CS2 59
    #define UI_DISPLAY_DI 59
    #define UI_DISPLAY_RW_PIN 59
    #define UI_DISPLAY_RESET_PIN 59


    /** \brief Are some keys connected?

    0 = No keys attached - disables also menu
    1 = Some keys attached
    */
    #define UI_HAS_KEYS 0


    /** \brief Is a back key present.

    If you have menus enabled, you need a method to leave it. If you have a back key, you can always go one level higher.
    Without a back key, you need to navigate to the back entry in the menu. Setting this value to 1 removes the back entry.
    */
    #define UI_HAS_BACK_KEY 1

    /* Then you have the next/previous keys more like up/down keys, it may be more intuitive to change the direction you skip through the menus.
    If you set it to true, next will go to previous menu instead of the next menu.

    */
    #define UI_INVERT_MENU_DIRECTION 0

    /** Uncomment this, if you have keys connected via i2c to a PCF8574 chip. */
    //#define UI_HAS_I2C_KEYS

    // Do you have a I2C connected encoder?
    #define UI_HAS_I2C_ENCODER 0

    // Under which address can the key status requested. This is the address of your PCF8574 where the keys are connected.
    // If you use a MCP23017 the address from display is used also for keys.
    #define UI_I2C_KEY_ADDRESS 0x40


    #ifdef UI_MAIN
  • Have you set in Configuration.h the FEATURE_CONTROLLER to user defined display as well? On a glance it look sok so far.
  • Hello,

    i have solved setting the pin in pins.h. I don't understand why this pins are defined in more files.


    Thanks
Sign In or Register to comment.