4 line LCD drivers in assembler needed.

And, without context, how can he expect anybody to know what he is looking for?

--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 Click to see the full signature
Reply to
CBFalconer
Loading thread data ...

Good for you. You have quickly caught on to how to include proper context in a usenet article. The various conventions in use in usenet generally have worthwhile objectives, so learning them early means you will communicate much better.

Here are a few handy references:

formatting link
formatting link
formatting link
formatting link
formatting link
formatting link

--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 Click to see the full signature
Reply to
CBFalconer

On 20 Aug 2005 08:01:42 -0700, "gobraves" wrote:

Look at the 8 bit drivers for a start. They will do everything in normal 8 bit mode. When you wish to write to the lcd in 4 bit mode, you will have to save the byte, shift the byte, either left or right 4 times, clear the unwanted bits, then write the nibble to the port. Then you return the saved byte, clear off the unwanted bits, and write the remaining nibble to the LCD port.

Here's my code for writing 4 bit data from a MSP430 to a PC0802 LCD. You might be able to obtain some ideas from this.

LCDTEMP contains the byte to be written to the LCD LCDOUT is the port where the LCD is located. /*********************************************/ /* LCD_WRITE - Writes a byte in LCDTEMP to the LCD in 4 bit mode */ /* Registers: LCDTEMP, LCDOUT, CTR1 /* Calls: LCD_WRITE2 /* Returns: nothing /*********************************************/ LCD_WRITE: push.b LCDTEMP ; save the byte rra.b LCDTEMP ; shift the byte so we have the MS Nibble rra.b LCDTEMP rra.b LCDTEMP rra.b LCDTEMP call #LCD_WRITE2 ; call the function that writes the nibble to the LCD pop.b LCDTEMP ; restore the byte so we can obtain the LS Nibble LCD_WRITE2: and.b #00Fh, LCDTEMP ; clear the unwanted bits bit.b #LCDRS, &LCDOUT ; check if the RS bit was already set on the LCD port jz WRC1 ; jump if RS is not set ( we're writing a command) bis.b #LCDRS, LCDTEMP ; if RS is set then set it in LCDTEMP as well (and we're writing data) WRC1: mov.b LCDTEMP,&LCDOUT ; send the LS nibble (and RS if set) to the display bis.b #LCDEN, &LCDOUT ; set the Enable bit mov.b #100,CTR1 ; a delay is required. The HD44780 datasheet doesn't give a minimum WRC2: ; defined time for E being high in 4 bit mode, but I found this works. dec CTR1 ; The value in CTR1 may need to change for different jnz WRC2 ; devices and voltage supplies. bic.b #LCDEN,&LCDOUT ; clear the Enable bit and wait a bit (pun -- har har har..er.hmmm.) mov.b #20, CTR1 ; wait for 37uS or so for the instruction to process in the display WRC3: dec CTR1 jnz WRC3 ret ; return to the calling function

Note that I was using an 8MHz crystal, which gives a 125nS cycle. The counter (CTR1) values would have to be adjusted for your own system.

This is the wiring diagram between the MSP430 and the LCD

  • MSP430F1101
  • ___________
  • | |
  • | P1.0 |
  • | P1.1 |
  • | P1.2 |
  • | P1.3 | PC0802A 8x2 LCD
  • | P1.4 | ___________
  • | P1.5 | gnd -- | D0 |
  • | P1.6 | gnd -- | D1 |
  • | P1.7 | gnd -- | D2 |
  • | |
gnd -- | D3 |
  • | P2.0 | -------- | D4 |
  • | P2.1 | -------- | D5 |
  • | P2.2 | -------- | D6 |
  • | P2.3 | -------- | D7 |
  • | P2.4 | -------- | E |
  • | P2.5 | -------- | RS |
  • | |
gnd -- | R/W |
  • | |
* *
Reply to
dmm

It's a shame you consider the biggest insult a poorly formed question.

Reply to
gobraves

This is Usenet! Home of the original flame-broiled poster.

No, civility in geekdom is not dead.

However one of the mainstays of civility in geekdom is not wasting other peoples time. This is accomplished by posting requests in a way that doesn't waste people's time. The smart-questions link explains all this quite well.

Is it better to igore the child wandering into traffic or to say nothing?

Why?

A poorly framed question implies to many that the questioner feels he is more important and his time more valuable than those to whom the question is addressed. IOW the questioner is treating the audience as if they are servants. In many cultures that is considered insulting.

--
Grant Edwards                   grante             Yow!  I feel... JUGULAR...
                                  at               
 Click to see the full signature
Reply to
Grant Edwards

Precisely. The members of this group are many things, but mind readers they are not.

IAn

Reply to
Ian Bell

Everything you say is correct. The biggest insult is the poorly formed question followed by the objection when this is pointed out. If you want a decent answer to a question make sure you give sufficient information.

Ian

Ian

Reply to
Ian Bell

It's not the "poorly formed question" per se, rather that it may be an indicator of a lack of respect for the value of other people's time which could be insulting. Or perhaps it is indicative that the poster has insufficient background knowledge to benefit from a realistic amount of effort helping him or her. Either way, it's not helpful to the ostensive cause.

A well thought-out (too much information is as bad as too little) polite/respectful query and some indication of what efforts have already been made to solve the issue on your own are both important, IMO.

"Laurie got offended that I used the word "puke." But to me, that's what her dinner tasted like."

-- Deep Thoughts, Jack Handy

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
 Click to see the full signature
Reply to
Spehro Pefhany

unwanted

Nibble

nibble to the LCD

LS Nibble

on the LCD port

a command)

as well (and we're writing data)

the display

datasheet doesn't give a minimum

bit mode, but I found this works.

for different

(pun -- har har har..er.hmmm.)

instruction to process in the display

with google search for a file "LCDSPI2" (Lcdspi2.zip) there you will find how to init an LCD to 4bit and also the data and cmd write routines for 4bit rw

Reply to
ryan weihl

Thanks to everyone for all your help..... netiquette and technical....

Reply to
gobraves

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.