MOP-AL404C Initialization problems

Support for MOC/MOS/MOI/MOU/X-Board/MOP

Moderator: Mods

Post Reply
Darkeyes_z33
LCD?
Posts: 2
Joined: Mon Jun 11, 2007 1:36 am
Location: UF
Contact:

MOP-AL404C Initialization problems

Post by Darkeyes_z33 » Mon Jun 11, 2007 1:39 am

Hi,

I recently ordered 2 of the MOP-AL404 LCDs. I have been trying for a few days now to get them to work but I can't seem to initialize them. All I get is the 1st and 3rd row of black bars. I've checked the forums but there doesn't seem to be very much information on this display.

I am trying to initialize for 4bit 4line mode. I understand that the first two lines are controlled by one Chip (E1) and the second by another Chip (E2).... so right now I am trying to set the first chip into 2line mode and right "Hello World".

I am using an Atmel Atmega128. I checked the connections according to the following datasheet (http://www.matrixorbital.ca/manuals/mop ... 404C-E.pdf)

LCD1-4(DB0-DB3): Gnd
LCD5-8(DB4-DB7): PortC 0-3
LCD9(E1): PortC 6
LCD10(R/W): PortC 5
LCD11(RS): PortC 4
LCD12(Vo): 10k Pot (Middle Tab)
LCD13(Gnd): Gnd
LCD14(Vcc): 5+
LCD15(E2): Gnd (For now)
LCD16(NC): NC

Here is the Atmel Code in C:

//=================================================================================================
//Description:
//Precondition:
//Postcondition:
//Returns:
void init_LCD()
{
DDRC |= 0x7F; //PORTC(6) is Enable
//PORTC 5-0 = R/W | RS | DB7 | DB6 | DB5 | DB4

timer_bdelay(45); //Delay for 15ms to allow VCC to settle

lcd_writeCmd(0x33, 10, 10); //Manual Initialization of LCD Driver
lcd_writeCmd(0x32, 10, 10); //Four bit operation


lcd_writeCmd(0x28, 5, 5); //Enable 2 lines
lcd_writeCmd(0x0F, 5, 5); //Display on; Cursor On; Blink On
lcd_writeCmd(0x01, 5, 5); //Clear Screen; Cursor Home

}
//=================================================================================================

//=================================================================================================
//Description: Abstracts how commands are written to the LCD driver
//Precondition: The lcd has been init and is in 4 bit mode
//Postcondition: The command has been executed
//Returns:
void lcd_writeCmd(char cmd, unsigned int wdelay, unsigned int edelay)
{
PORTC = ( (cmd & 0xF0) >> 4) | 0x40; //Write upper nibble to cmd register
PORTC ^= 0x40; // Enable = 0... Falling edge signals to read bus

timer_bdelay(wdelay); //Delay 1ms for write to settle [Hold time > 100us]

PORTC = ( (cmd & 0x0F) ) | 0x40; //Write lower nibble to cmd register
PORTC ^= 0x40;

timer_bdelay(edelay); //Delay 2ms (Wait for instruction to execute)
}
//=================================================================================================

//=================================================================================================
//Description: Abstracts how data is written to the LCD
//Precondition: the lcd has been init and is in 4 bit mode
//Postcondition: The character appears on the screen at the current cursor posistion
//Returns:
void lcd_writeData(char data, unsigned int wdelay, unsigned int edelay)
{
PORTC = ( (data & 0xF0) >> 4) | 0x40 | 0x10; //Enable = 1... RS = Data register
PORTC ^= 0x40; // Enable = 0... Falling edge signals to read bus

timer_bdelay(wdelay); //Delay 1ms for write to settle [Hold time > 100us]

PORTC = ( (data & 0x0F) ) | 0x40 | 0x10; //Write lower nibble to cmd register
PORTC ^= 0x40;

timer_bdelay(edelay); //Delay 2ms (Wait for instruction to execute)
}
//=================================================================================================


I have two other LCDs 20x2 and they work perfectly with this code. They have the HD44780u Chip which the site claims the MOPs are compatiable with.


Thanks,
Thomas McDonley

Raquel
Matrix Orbital
Matrix Orbital
Posts: 689
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel » Mon Jun 11, 2007 4:42 pm

Hello Thomas,

Thanks for your post.

Yes, you are right, there are 2 LCD chip drivers (E1 and E2) on the 4x40 displays. Because of this, you will need to do exactly the same initialization on both. In your lcd_writeCmd function, you might want to add a fourth parameter that indicates which LCD (E1 and E2) you are initializing. With this parameter you will know which of your port pin will be controlled (I see though that you have E2 grounded).

When you iniitialize with the 2x20, you were only just talking to 1 LCD driver, now that you have two for the 4x40, you will need to enable the driver you are talking to, taking the E1 or E2 high or low accordingly.

I hope this helps.
Raquel Malinis
Design and Development
Matrix Orbital

Darkeyes_z33
LCD?
Posts: 2
Joined: Mon Jun 11, 2007 1:36 am
Location: UF
Contact:

Post by Darkeyes_z33 » Mon Jun 11, 2007 7:20 pm

Hey Raquel,

I figured out the problem but would like verification. Going off of the datasheet (http://www.matrixorbital.ca/manuals/mop ... 404C-E.pdf) I assumed that the datalines used in 4bit mode where DB4-7 which is the case with the LCDs I currently use. The flowchart in the datasheet even suggests this.

However I have found something very weird which leads me to believe that pinout is not correct in the datasheet. I started to think that maybe the lines used for 4bit mode were DB0-3 BUT I accidently hooked it up backwards. Surprisingly it solved my problem and now I have a fully working 4line display.

I would like to verify that the datasheet is indeed wrong and that I haven't just found some weird wiring that works =P. Below is the wiring I am using that works:

LCD4-1(DB4-DB7): PortC 0-3
LCD8-5(DB0-DB3): Gnd
LCD9(E1): PortC 6
LCD10(R/W): PortC 5
LCD11(RS): PortC 4
LCD12(Vo): 10k Pot (Middle Tab)
LCD13(Gnd): Gnd
LCD14(Vcc): 5+
LCD15(E2): PortC 7
LCD16(NC): NC

Here is what the Datasheet says:
1 DB0 H/L Data bit 0
2 DB1 H/L Data bit 1
3 DB2 H/L Data bit 2
4 DB3 H/L Data bit 3
5 DB4 H/L Data bit 4
6 DB5 H/L Data bit 5
7 DB6 H/L Data bit 6
8 DB7 H/L Data bit 7
9 E1 H,H→L Chip1 enable signal
10 R/W H/L H: Read(MPU→Module) L: Write(MPU→Module)
11 RS H/L H: DATA, L: Instruction code
12 VO (Variable) Operating voltage for LCD
13 VSS 0V Ground
14 VDD 5.0V Supply Voltage for logic
15 E2 H,H→L Chip2 enable signal
16 NC NC NC
17 LED(+) Anode of LED Backlight
18 LED(-) Cathode of LED Backlight


Here is what I found to be true:
1 DB7 H/L Data bit 7
2 DB6 H/L Data bit 6
3 DB5 H/L Data bit 5
4 DB4 H/L Data bit 4
5 DB3 H/L Data bit 3
6 DB2 H/L Data bit 2
7 DB1 H/L Data bit 1
8 DB0 H/L Data bit 0
9 E1 H,H→L Chip1 enable signal
10 R/W H/L H: Read(MPU→Module) L: Write(MPU→Module)
11 RS H/L H: DATA, L: Instruction code
12 VO (Variable) Operating voltage for LCD
13 VSS 0V Ground
14 VDD 5.0V Supply Voltage for logic
15 E2 H,H→L Chip2 enable signal
16 NC NC NC
17 LED(+) Anode of LED Backlight
18 LED(-) Cathode of LED Backlight

Note: I did check that my silk screen matches the pinout described in the datasheet. It seems that only the DB are messed up; everything else is fine.


As a side note: E1 and E2 are independant so I was just trying to put the first chip into 2line mode and print something to it (treat the 4line display as only a 2line) just to get it working. But yes I will and have made the suggested modification to my code.

Thanks and please let me know,
Thomas McDonley

Raquel
Matrix Orbital
Matrix Orbital
Posts: 689
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel » Tue Jun 12, 2007 12:11 pm

Hello Thomas,

Sorry about the error in the manual. We are getting that changed now as we speak. We will have it updated this afternoon.

Thanks,
Raquel Malinis
Design and Development
Matrix Orbital

Raquel
Matrix Orbital
Matrix Orbital
Posts: 689
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel » Mon Jun 18, 2007 9:44 am

The manual has been updated.
Thanks,
Raquel Malinis
Design and Development
Matrix Orbital

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests