EmbeddedRelated.com
Forums

4bit LCD C code

Started by cbhargava March 5, 2011
Looks like it did not render properly on yahoo groups.

Look at the schematic here in the header.

https://github.com/microwiz/msp430-lcd4bit/blob/master/main.c

--- In m..., "cbhargava" wrote:
>
> /*
> 4bit LCD drive code posted by Dan Bloomquist on MSP430 Yahoo Group.
> Modified by Chetan BhargavaCompiler: MSPGCC4Testbed: TI Launchpad
> MSP430G22xx HD44780 LCD -----------------
> ---------------- | | |
> | | |-------|GND | |
> |-------|DB0 | | |-------|DB1 |
> | |-------|DB2 | | |-------|DB3
> | | |-------|RW | | V
> | | | | |
> P1.0|------------|DB4 | P1.1|------------|DB5
> | P1.2|------------|DB6 |
> P1.3|------------|DB7 | | |
> | P1.3|------------|EN |
> P1.1|------------|RS | | |
> Original code uses RW line of the LCD but as we will only write to the
> LCD it might not be needed.
> */
> I embedded the schematic in the header.
>
> > No, I did not see a schematic link. 'confilcting types' says that your
>
>
>

Beginning Microcontrollers with the MSP430

This is more clear rendering in browser.

https://github.com/microwiz/msp430-lcd4bit/raw/master/main.c
--- In m..., "cbhargava" wrote:
>
> Looks like it did not render properly on yahoo groups.
>
> Look at the schematic here in the header.
>
> https://github.com/microwiz/msp430-lcd4bit/blob/master/main.c
>

cbhargava wrote:
> This is more clear rendering in browser.
>
> https://github.com/microwiz/msp430-lcd4bit/raw/master/main.c
>

Very nice work. Please keep posted on how it pans out in the real world.
The next time I do a display I most certainly plan to go the I2C way.
(then the extra pins are there if you need them, doesn't matter!) Yet I
haven't checked if the timing on 'read' will clear the pcf8574 spec, it
is a 'strange' device. I've only used it to read a switch setting so
far; but for writes it should be easy.

Best, Dan.

As a matter of fact my next step would be to use i2c expander or a 5 cent shift register. Jameco has a shift register for 5 cent.

I have the IO expander currently built on a small RadioShack PCB with two LEDs. The board is connected to the launchpad running the i2c master demo firmware from TI.

Maybe I'll post a picture.

--- In m..., Dan Bloomquist wrote:
>
> cbhargava wrote:
> > This is more clear rendering in browser.
> >
> > https://github.com/microwiz/msp430-lcd4bit/raw/master/main.c
> >
>
> Very nice work. Please keep posted on how it pans out in the real world.
> The next time I do a display I most certainly plan to go the I2C way.
> (then the extra pins are there if you need them, doesn't matter!) Yet I
> haven't checked if the timing on 'read' will clear the pcf8574 spec, it
> is a 'strange' device. I've only used it to read a switch setting so
> far; but for writes it should be easy.
>
> Best, Dan.
>

cbhargava wrote:
> This is more clear rendering in browser.
>
> https://github.com/microwiz/msp430-lcd4bit/raw/master/main.c
>

Before I go for the night, one thing I noticed is you have the data buss
on P.0 to P.3 where I write the code for P.4 to P.7. Change the code or
change the pin assignments.

Best, Dan.

I fixed the data port, RS and EN lines. I had it jumbled up before.
--- In m..., Dan Bloomquist wrote:
>
> Before I go for the night, one thing I noticed is you have the data buss
> on P.0 to P.3 where I write the code for P.4 to P.7. Change the code or
> change the pin assignments.
>
> Best, Dan.
>

Launchpad with i2c port expander PCF8574

--- In m..., Dan Bloomquist wrote:
> The next time I do a display I most certainly plan to go the I2C way.
> (then the extra pins are there if you need them, doesn't matter!) Yet I
> haven't checked if the timing on 'read' will clear the pcf8574 spec, it
> is a 'strange' device. I've only used it to read a switch setting so
> far; but for writes it should be easy.
>
> Best, Dan.
>

Launchpad with i2c port expander PCF8574

http://www.flickr.com/photos/cbhargava/5512862128/

cbhargava wrote:
> Launchpad with i2c port expander PCF8574
>
> http://www.flickr.com/photos/cbhargava/5512862128/
>

If you want to experiment I highly recommend you get prototype boards
from Jemco, they are the best quality in my experience. And a handful of
telephone cable. That wire they sell for those boards is worthless. I
have some ~100 pair chunks of cable I pull wire from. It just makes life
fun.



Best, Dan.

I have a few 3M breadboards and a couple from Jameco.
Jameco is 20 minus away from where I work :-)

--- In m..., Dan Bloomquist wrote:
>
> cbhargava wrote:
> > Launchpad with i2c port expander PCF8574
> >
> > http://www.flickr.com/photos/cbhargava/5512862128/
> >
>
> If you want to experiment I highly recommend you get prototype boards
> from Jemco, they are the best quality in my experience. And a handful of
> telephone cable. That wire they sell for those boards is worthless. I
> have some ~100 pair chunks of cable I pull wire from. It just makes life
> fun.
>
> Best, Dan.
>