Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

lcd display, non 44780 variant, Batron 16x2 w NT3881D

Status
Not open for further replies.

mgbglasgow

Junior Member level 1
Junior Member level 1
Joined
Jun 15, 2011
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,508
hi all,

have lcd module thats is not 44780, have code that worked with that, now new lcd module that suggests it is compliant seems not to be, data sheet is very weak. Any one any experience using this type of controller. Wait/Timing commands are questionable.

Basically looking for explanation of differences to timings/commands, i will write a driver for it (hack the 44780 code basically!)

controller is **broken link removed**

lcd unit via RS uk is https://uk.rs-online.com/web/p/lcd-monochrome-displays/7436144/

code is standard:

/*
*
*
*/

#ifndef _XTAL_FREQ
// Unless specified elsewhere, 4MHz system frequency is assumed
#define _XTAL_FREQ 8000000
#endif


#include <htc.h>
#include "lcd.h"


#define LCD_RS RA5
#define LCD_RW RA0
#define LCD_EN RA4


#define LCD_DATA PORTB
#define LCD_STROBE() ((LCD_EN = 1),__delay_us(10),(LCD_EN=0))



/* write a byte to the LCD in 4 bit mode */

void
lcd_write(unsigned char c)
{
__delay_us(100);
LCD_DATA = ( ( c >> 4 ) & 0x0F );

LCD_STROBE();
LCD_DATA = ( c & 0x0F );

LCD_STROBE();
}

/*
* Clear and home the LCD
*/

void
lcd_clear(void)
{
LCD_RS = 0;
lcd_write(0x1);
__delay_ms(2);
}

/* write a string of chars to the LCD */

void
lcd_puts(const char * s)
{
LCD_RS = 1; // write characters
while(*s)
lcd_write(*s++);
}

/* write one character to the LCD */

void
lcd_putch(char c)
{
LCD_RS = 1; // write characters
lcd_write( c );
}


/*
* Go to the specified position
*/

void
lcd_goto(unsigned char pos)
{
LCD_RS = 0;
lcd_write(0x80+pos);
}

/* initialise the LCD - put into 4 bit mode */
void
lcd_init()
{
char init_value;

ADCON1 = 0x06; // Disable analog pins on PORTA

init_value = 0x30;
TRISA=0;
TRISB=0;
TRISC=0;

PORTB = 0;
LCD_RS = 0;
LCD_EN = 0;


__delay_ms(50); // wait at least 15mSec after power applied,

PORTB = 0x30;// load PortB with 0x30
__delay_us(10); //allow to stabilise
LCD_STROBE(); // pulse EN high to load
__delay_ms(5); //allow time>4.1 ms

PORTB = 0x30; //reload PortB with 0x30
__delay_us(10); //allow to stabilise
LCD_STROBE(); // pulse EN high to load
__delay_us(120); //allow time>100 us

PORTB = 0x30; //reload PortB with 0x30
__delay_ms(5); //allow to stabilise
LCD_STROBE(); // pulse EN high to load
__delay_us(10); //allow time>100 us



PORTB = 0x20; // Four bit mode
__delay_us(10); //allow to stabilise
LCD_STROBE();
__delay_ms(150);

PORTB = 0x20; // Four bit mode
LCD_STROBE();
__delay_ms(150);


lcd_write(0x0F); // Display On, Cursor On, Cursor Blink
lcd_clear(); // Clear screen
lcd_write(0x06); // Set entry Mode


}




Steve in glasgow
 

At first glance at the display and controller datasheets, it looks 44780 compatible.
Do you have a voltage on the V0 pin? Otherwise the display can be so dim it is not visible.
Also, maybe try extending (e.g. doubling) all your delays, in case the delay routines are intended for a
slower clock (or try confirming that with a scope or inspecting the delay function).
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top