Serial LCD firmware - will it do 40x2?

ArnieW

Senior Member
I'm working on a project that needs to display a lot of information and I've just received my 40x2 LCDs in the mail. I'm still trying to figure out the best way of driving one, and although the purist in me wants to invent my own system (inspired by Hippy for example) the pragmatist in me wants to finish the project some time soon.

So I'm happy with the idea of getting the serial LCD firmware offered by Rev-Ed (FRM010) but just wanted to clarify something.

In the datasheet it refers to the following in the parts list:

1 alphanumeric LCD module (16x2).​

Does this mean the firmware only supports a smaller LCD? Or can I actually use a 40x2 with it?
 

tarzan

Senior Member
The FRM010 will drive a 20x4, I’ve not used a 40x2 but it should work.

After many trials with the FRM010 I resorted do using a Picaxe 28X1 as an i2cslave to drive my 20x4 LCD as this allowed for faster updates than I was able to accomplish with hserout.

Code for this can be found here: posts 9 & 10
http://www.picaxeforum.co.uk/showthread.php?t=8521
 

westaust55

Moderator
Often a 40x2 (or 2 x 40) LCD module is physically laid out as 4x20.
Each of the 2 lines of 40 characters is split into two halves, but not adjacent.

So the layout is:
1. First 20 characters of line 1
2. First 20 chars of line 2
3. Second 20 chars of line 1
3. Second 20 chars of line 2

Is this the type of "40x2" display you are using?
 

eclectic

Moderator
I'm using the firmware, wired for n2400.

Code loaded
Code:
main:
serout 0, n2400, (254,1)
pause 100
serout 0, n2400, (254,128)

serout 0, n2400, ("Hello ArnieW. This 40 x 2 is OK")

serout 0, n2400, (254,192)

serout 0, n2400, ("0123456789 abcdefghijklmnopqrstuvwxyz ")
e.
 

Attachments

hippy

Ex-Staff (retired)
Staff member
It should work. The only difference is usually in how the LCD screen characters are mapped to the internal controller character RAM. Common mapping is, for SEROUT control commands ...

254,$80 - Line 1 char 1
254,$C0 - Line 2 char 1
254,$A0 - Line 1 char 17 or 21
254,$E0 - Line 2 char 17 or 21

This doesn't always apply so best to write test code to send as many characters as fit on one line using each of those control commands and see where they are put on the screen. For eclectic 254,$C0 is line 2 char 1 and all 40 characters are contiguous.

Sometimes you get lucky and you only need to send a control command to set which line, other times you have to send a control code for every half line. Depends on the actual LCD used.
 

ArnieW

Senior Member
I'm using the firmware, wired for n2400.

Code loaded
Code:
main:
serout 0, n2400, (254,1)
pause 100
serout 0, n2400, (254,128)

serout 0, n2400, ("Hello ArnieW. This 40 x 2 is OK")

serout 0, n2400, (254,192)

serout 0, n2400, ("0123456789 abcdefghijklmnopqrstuvwxyz ")
e.
Thanks eclectic,

That is better service than I expected ;)

It is touching to see my name in crystals ... thanks for your quick response.
 

ArnieW

Senior Member
Often a 40x2 (or 2 x 40) LCD module is physically laid out as 4x20.
Each of the 2 lines of 40 characters is split into two halves, but not adjacent.

So the layout is:
1. First 20 characters of line 1
2. First 20 chars of line 2
3. Second 20 chars of line 1
3. Second 20 chars of line 2

Is this the type of "40x2" display you are using?
The datasheet shows it to be a true 40x2.
 

ArnieW

Senior Member
It should work. The only difference is usually in how the LCD screen characters are mapped to the internal controller character RAM. Common mapping is, for SEROUT control commands ...

254,$80 - Line 1 char 1
254,$C0 - Line 2 char 1
254,$A0 - Line 1 char 17 or 21
254,$E0 - Line 2 char 17 or 21

This doesn't always apply so best to write test code to send as many characters as fit on one line using each of those control commands and see where they are put on the screen. For eclectic 254,$C0 is line 2 char 1 and all 40 characters are contiguous.

Sometimes you get lucky and you only need to send a control command to set which line, other times you have to send a control code for every half line. Depends on the actual LCD used.
Line 1 addresses begin at $00 and end at $27
Line 2 addresses begin at $40 and end at $67.

I know that the standard AXE033 kit uses addressing that starts at $80. I've not read anything about an offset, so am I likely to need '254, $40' to start at the second line? I'm sorry but I don't have any way to test the theory yet.
 

ArnieW

Senior Member
I'm using the firmware, wired for n2400.

Code loaded
Code:
main:
serout 0, n2400, (254,1)
pause 100
serout 0, n2400, (254,128)

serout 0, n2400, ("Hello ArnieW. This 40 x 2 is OK")

serout 0, n2400, (254,192)

serout 0, n2400, ("0123456789 abcdefghijklmnopqrstuvwxyz ")
e.
I had hoped to reply with a photo on this, but I can report the following code to be working:

Code:
main:
	serout 0, n2400, (254,1)
	pause 100
	serout 0, n2400, (254,128)
	
	serout 0, n2400, ("Hello eclectic. Thanks for helping with ")
	
	serout 0, n2400, (254,192)
	
	serout 0, n2400, ("the 40 x 2! All good now :-)")
It seems the LCD I have needs the full 5V to give a crisp display. I can just read the characters on screen, but they don't show up in the photo.

Thanks to all who have helped. I've used a reclaimed axe033 board as the driver.
 

hippy

Ex-Staff (retired)
Staff member

Pekari

Senior Member
Thanks!

AXE133 code seems to be a open source.

Is it possible to modify it to 18X? I mean that firmware code.
 

hippy

Ex-Staff (retired)
Staff member
I don't believe the AXE133 code can be modified for the 18X as some pins required to be outputs can only be input pins on the 18X. There may be other requirements as well.
 

Pekari

Senior Member
Now I buy PICAXE 18M2 chip and programmed it with axe133 code.
My axe033 display doesn't work with it. Why?

How are those boards differents?
 

nick12ab

Senior Member
How are those boards differents?
These are some of the differences:
  1. The AXE033 uses 4-bit mode and the AXE133 uses 8-bit mode for interfacing the LCD
  2. The AXE033 doesn't have PICAXE download circuitry as the AXE033 uses a raw PIC
  3. The LCD interface lines connect to seemingly random different pins on the AXE033, a sensible setup is used on the AXE133
  4. They use different serial in pins
  5. The AXE033 accomodates a DS1307 but the AXE133 doesn't
 

Pekari

Senior Member
Thanks!

Is it possible to make work axe033 with picaxe 18M2 chip?

Is there somewhere code for this or do I have to make it myself?
 

nick12ab

Senior Member
Thanks!

Is it possible to make work axe033 with picaxe 18M2 chip?

Is there somewhere code for this or do I have to make it myself?
You have to do it yourself. I don't have an AXE033 to hand right now but just check yours to see what the microcontroller pins connect to and providing the AXE033 doesn't require an output on an input-only pin or an input on an output-only pin and you're willing to have a painfully slow serial LCD module, then it's fine.
 

Technical

Technical Support
Staff member
Thanks!

Is it possible to make work axe033 with picaxe 18M2 chip?

Is there somewhere code for this or do I have to make it myself?
No it is not easily done due to the layout. It would be far better to just replace the AXE033 chip with a spare.
 

g6ejd

Senior Member
I'm using the standard axe033 firmware with a 20x4 display without any problems. Once you figure out the line number addresses, it's easy.
 

john2051

New Member
@ArnieW
Hi, if the 40x2 displays are the same as mine they have two Enable pins, one for the top, and one for the bottom 2 rows.
I intend to modify an axe133y board, using one of the spare ports to drive this other pin. It shouldnt need the code drastically
modifying, but we'll see!
Regards john
 

g6ejd

Senior Member
The 40x2 displays I have and use just need to be addressed to print on either the top or bottom rows, there's no need to toggle a pin. Try a simple test programme that increments the character addressing position.
 

john2051

New Member
@g6ejd

Hi, Which make are the lcds you have? I got mine from rapid, and I think they are made by
Winstar.
Is that your callsign?

regards john m0ers
 

g6ejd

Senior Member
Hi John,

Yes G6EJD, Melksham.

I got my Winstar display from By_vac (google will link to them). A 20x4 display for example that works well with a picaxe033 display driver board cost me £9.50 and it looks like an OLED to me. I have others too. My current favourite is a JHD204A I think they all use the same driver IC. Addressing the display is a bit cranky, but once resolved easy to programme in the PICAXE.

Here's an extract from my code for a 20x4 line:

symbol Line1 = 128
symbol Line2 = 192
symbol Line3 = 148
symbol Line4 = 212

So Line-1 position 1 is 128,1 and Line-4, position 1 is 212,1

I'm active on all bands www.dsbird.org.uk is my home web page.

David
 

john2051

New Member
Hi david,

I actually mis-read your very first message, I thought it read 40x4!!! never mind.

The 20x4 displays I've had no trouble with, but the displays I have (40x4) behave as two physical displays.
My first callsign was G7ERS, later when my wife and I did the morse test, I got M0ERS !

I'm hoping to get at my radios very soon, so you might hear me soon from Lincoln.
Thanks & regards john
 
Top