hi all, i have a Silicon Laboratories 8051F330 micro controller development board and a lumex LCD (data sheet -
formatting link
i am trying to connect the LCD to the 8051. i tried to connected the LCD directly to the 8051, but that doesn't seem to work. any one have any suggestion? and also does the LCD display anything if its connected correctly but with out any setting on the 8051?
thank you
Didn't find your answer? Ask the community — no account required.
D
DaveM
There's no indication as to the type of controller the display uses. In any case, to make the display work, it has to be initialized by the uP in a specific sequence. You need to get the initialization sequence and program it into your uP. Those instructions should be supplied by Lumex somewhere on their web site.
Dave M
MasonDG44 at comcast dot net (Just substitute the appropriate characters in the
address)
"In theory, there isn\'t any difference between theory and practice. In
practice, there is." - Yogi Berra
M
mpm
-
formatting link
I am not familar with the F330, but am going to assume its just another 8051 processor. Yes, you can hook the LCD directly to an 8051. You will have to initialize the LCD before you can use it. This gets asked a lot, so you can probably find code on the web to do it. (Or SED Archive)
Most people seem to get stuck because they do not wait long enough in software for the LCD to accept the initialization commands, OR, they try to use the LCD's BUSY flag before the LCD Busy flag has any real meaning (i.e, not until AFTER the thing has been initialized).
If you just power the LCD up, you should see dark squares (usually all positions, but sometimes only half of them depending on the display). Be advised there is a contrast voltage on the LCD. Depending on the setting, your LCD may not appear to be doing anything, but in reality, its contrast setting may just be set to very, very faint. Check the datasheet and try adjusting the contrast voltage to be sure.
If you can't get this LCD going, write back whether you've wired it in
4-bit or 8-bit mode (most likely you're in 8-bit?), and one of us can post the init code for you. -mpm
D
Donald
formatting link
Like these ?
formatting link
M
MooseFET
-
formatting link
Thats just the mechanical datasheet find the one that tells you about the signals and read it carefully. Watch out for the legal timing.
It is an 8051 with added features and a 25MIPS throughput IIRC.
G
Gary Tait
ParTizan wrote in news: snipped-for-privacy@19g2000hsx.googlegroups.com:
It looks like a standard HD447800 LCD, which have thousands of resources and documents you can use.
i already read the tutorial about the lcd's(my lcd data sheet -
formatting link
i also tried the to use the program from the 8052.com tutorial on my Silicon Laboratories
8051F330 but it doesnt seem to work.
here is the code:
$NOMOD51
$include (c8051f330.inc) ; Include register definition file.
;----------------------------------------------------------------------------- ; RESET and INTERRUPT VECTORS ;-----------------------------------------------------------------------------
; Reset Vector cseg AT 0 ljmp Main ; Locate a jump to the start of ; code at the reset vector. DB0 EQU P0.0 DB1 EQU P0.1 DB2 EQU P0.2 DB3 EQU P0.3 DB4 EQU P0.4 DB5 EQU P0.5 DB6 EQU P0.6 DB7 EQU P0.7 EN EQU P1.5 RS EQU P1.7 RW EQU P1.6 LCDDATA EQU P0
WAIT_LCD:
CLR EN ;Start LCD command CLR RS ;It's a command SETB RW ;It's a read command MOV LCDDATA,#0FFh ;Set all pins to FF initially SETB EN ;Clock out command to LCD MOV A,LCDDATA ;Read the return value JB ACC.7,WAIT_LCD ;If bit 7 high, LCD still busy CLR EN ;Finish the command CLR RW ;Turn off RW for future commands RET ; following program code. INIT_LCD:
CLR RS MOV LCDDATA,#38h SETB EN CLR EN LCALL WAIT_LCD CLR RS MOV LCDDATA,#0Eh SETB EN CLR EN LCALL WAIT_LCD CLR RS MOV LCDDATA,#06h SETB EN CLR EN LCALL WAIT_LCD RET
CLEAR_LCD:
CLR RS MOV LCDDATA,#01h SETB EN CLR EN LCALL WAIT_LCD RET
WRITE_TEXT:
SETB RS MOV LCDDATA,A SETB EN CLR EN LCALL WAIT_LCD RET
Main: ; Disable the WDT. anl PCA0MD, #NOT(040h) ; clear Watchdog Enable bit
and i can figure out were the problem is could some one send me a working example? i am a beginner so dont really know how to configure the ports. could someone tell me if its done right in the example above? tnx all
T
Tom2000
From the pinouts, it appears that your LCD uses the HD44780 interface, found on just about all inexpensive parallel LCD displays these days.
I don't use anything from the 8051 family, but I've driven '44780 LCDs with several other MCU's using the following method.
First, I use the "4-bit" interface. I connect MCU output lines to DB4-DB7, EN, and RS. I ground the LCD's R/W input, and leave DB0-DB3 open.
The EN line is your clock line. It idles low, is raised for a millisecond or so to clock data on the DB lines, then is returned low.
The RS line is your command/data line. Set it high to indicate that the info you're clocking on the DB lines is data, or set it low to indicate that the DB info represents a command.
My output routine takes a byte as its input, splits it into two nibbles, then clocks those two nibbles to the DB lines, high nibble first, MSbit on DB7. (Make sure that the calling routine sets the RS line to the correct state before sending the byte.)
-place high nibble on DB lines -EN high -pause 1 millisecond -EN low -pause 1 mS -place low nibble on DB lines -EN high -pause 1 mS -EN low -pause 1 mS
In your program, wait about 1 second after powerup before you try to initialize the LCD (or, for that matter, anything else.) Then send the following sequence:
This is the initialization sequence that puts the LCD into the 4-bit mode:
2.
folowed by three other bytes that put the LCD into 2-line display mode, no display shift, cursor off, and 5x7 font:
4. 3. $28 4. $0c 5. $06c 5.
While sending these five initialization bytes, I pause 15 milliseconds between each byte. After the display has been intialized, I don't add interbyte pauses for any other LCD traffic.
By the way - this stuff is simple! I think that the problem folks have when driving an LCD is that they try to make it too complicated. Keep your routine simple, and I'm sure all will go well.
void SendStr(const char* str, const byte addr) { // Send string at addr, if addr 0, // or cursor position if addr == 0
int i = 0; if (addr != 0) Lcmd(addr); while (str[i] != 0) Ldat(str[i++]); }
void Lcmd(byte Cmd) { // Sends a byte to LCD in command mode PORTC &= B11101111; // RS low Lout(Cmd); } void Ldat(byte Dat) { // Sends a byte to LCD in data mode PORTC |= B00010000; // RS high Lout(Dat); }
void Lout(byte Dat) { // Sends Dat to LCD. Calling routine sets RS to Command (Low) or // Data (High) mode clock2LCD(Dat >> 4); // Place high nibble on low bits clock2LCD(Dat & B00001111); // Send low nibble }
void clock2LCD(byte nibble) { // Clock low 4 bits of nibble to LCD PORTC &= B11110000; PORTC |= nibble; PORTB |= B00000100; // Strobe data using EN delay(1); PORTB &= B11111011; delay(1); }
==========================================
G
Gary Tait
Tom2000 wrote in news: snipped-for-privacy@4ax.com:
It it is just, the 8051, configured the right way for CPU bus mode, can in theory, directly run an LCD character display in 8-bit mode.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.