Welcome! Log In Create A New Profile

Advanced

How Do I Configure Pinouts For A LCD

Posted by icecubemethman 
How Do I Configure Pinouts For A LCD
September 04, 2021 11:38AM
I just joined this forum, i don't use forums very often so here goes:

TLgrinning smileyR: i attempted to configure new pinouts for a LCD in marlin, and the LCD still doesnt work, so im hoping that i can gain some insite on if i am configuring marlin properly or not, before i try to replace hardware.

i have a wanhao duplicator i3 v1. i pulled out the melzi board from the printer, and am in the process of swapping it with a MKS Gen L v1 board. you can see the LCD working here

I setup marlin for this printer via some guides and some tips from the wanhao/Monoprice facebook group, but im stuck when it comes to the screen. I originally had just enabled #define LCD_FOR_MELZI but that did nothing. the internet said that the display connector plug needed to be rotated 1800 or rewired. i opted to file the orienting tab off the connector and then i was able to get backlight working finally.

i eventualy found the pinout for the LCD and so i attempted to edit the pins_MKS_GEN_L.h filet to match the LCD pinout, and that didnt do a thing.

if ENABLED(LCD_FOR_MELZI)
define LCD_PINS_ENABLE 16
define LCD_PINS_RS 35
define LCD_PINS_D4 25
define BEEPER_PIN 27
define KILL_PIN 29
define BTN_EN1 23
define BTN_EN2 37
define BTN_ENC 17
endif


I based that edit on these:

this is the pinout of the MKS board and,
this is the pinout for the LCD

it takes some mental gymnastics, for me at least, to figure out what pin on the LCD corresponds to what MKS pin, and honestly i dont know if i programmed that properly, so i dont know if its just the edit i made being poorly formatted, OR if i should put that edit in a different configuration file all together.

now i was looking in conditionals_LCD.h file and noticed that:

#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) || ENABLED(LCD_FOR_MELZI) || ENABLED(SILVER_GATE_GLCD_CONTROLLER)
  #define DOGLCD
  #define U8GLIB_ST7920
  #define REPRAP_DISCOUNT_SMART_CONTROLLER
#endif

so now i think that i need to change the if ENABLED(LCD_FOR_MELZI) to if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) but that doesnt seem to change anything. ive also tried #ifndef statements but those dont seem to work.

my cotrast is set properly, so i know its not that. and i know the LCD works, so now im wondering if my cable is pooched. my buddy has a similar cable so i may try it.

thanks in advancethumbs up
Re: How Do I Configure Pinouts For A LCD
September 06, 2021 11:17AM
Sometimes the plugs on the end of the cables are reversed,so you have to turn one by 180
Re: How Do I Configure Pinouts For A LCD
September 06, 2021 11:44AM
so was filing the orientation tab on the connector and plugging it in the "wrong way" not actualy flipping it 1800?
Re: How Do I Configure Pinouts For A LCD
September 06, 2021 09:25PM
You cannot just plug this lcd into exp1 of the MKS Gen L v1

Melzi Ardentissimo pins (from your picture)
5v  D10 D11 D16 D17
gnd D31 D30 D29 D28


mks gen_l pins from [github.com]
gnd D27 D23 D17 D37
5v  D29 D25 D16 D35


Note that the 5v and gnd are switched over, you cannot correct this by flipping the plug 180.

You need to make up a custom cable.

Also note the power end of the cable is without the red stripe.
With it plugged into the MKS GEN_L like you have it, your feeding power into the wrong end of the cable.

Edited 6 time(s). Last edit at 09/06/2021 11:52PM by Dust.
Re: How Do I Configure Pinouts For A LCD
September 08, 2021 07:45PM
Quote
Dust
You cannot just plug this lcd into exp1 of the MKS Gen L v1

Melzi Ardentissimo pins (from your picture)
5v  D10 D11 D16 D17
gnd D31 D30 D29 D28


mks gen_l pins from [github.com]
gnd D27 D23 D17 D37
5v  D29 D25 D16 D35


Note that the 5v and gnd are switched over, you cannot correct this by flipping the plug 180.

You need to make up a custom cable.

Also note the power end of the cable is without the red stripe.
With it plugged into the MKS GEN_L like you have it, your feeding power into the wrong end of the cable.

thanks for your reply.

i was under the impression that if the backlight is on, then the screen is being properly powered and plugged in properly, etc. i guess ill have to try to breadboard the LCD or build a new cable.

i figured out the software side i thing, i dont think that the if statements are correct, because the arduino compiler screeched at me untill i changed it to a #ifndef conditional so hopefully i have that covered
Sorry, only registered users may post in this forum.

Click here to login