Losing hours over stupid lcds

Steve2381

Senior Member
Hello all

I have not tinkered with my Picaxe ICs for quite a while, so last night I thought I would break out the Axe091 and connect up an LCD to a Picaxe.

Yea... this box of Picaxe chips are dangerously near going in the bin

Started with a Parallel LCD that I know worked, but after an evening playing around, and no luck, I gave up on that.

So dug out some LCM1602 LCD screens with a piggybacked I2C converter on them. They are the version that does not have an adjustable address, so I don't actually know what address they are.

But, after spending all morning on it... trying addresses $71, $e2, $40, $20, $4e, $c6... no luck. Tried another IC and tried another screen. Zip.

Clearly I am doing something wrong.

So before I resign this box of Picaxe to the bin and go back to my Teensy, anyone got any ideas?

I used this to fire it up (which might be the issue)

init:
setfreq m8
pause 500 ; wait for display to initialise
hi2csetup i2cmaster,$27,i2cslow,i2cbyte ; set up i2c master for LCD



main:
hi2cout 0,(254,128,255) ; move to start of first line
pause 10 ; wait for LCD to process data
hi2cout 0,("Hello!123",255) ; output text
end

Frustrated!
 

inglewoodpete

Senior Member
The i2c address won't be $27 because the least significant bit is always 0 when a PICAXE is the master. The correct address would probably be $4E (=$27 shifted 1 bit to the left).

For a parallel LCD, try this "universal" code that I posted a few years ago. It can be frustrating: that's why I developed this code.
 

Steve2381

Senior Member
I just checked the display with an I2Cscanner on a Teensy.... 0x3f

So what is that in weird PicaxeLand? $4e doesn't work
 

stan74

Senior Member
I saw a picaxe hi2c address finder on the forum recently.
0x3f * 2 = 0x7e.
Going back to using a system like picaxe after not using for a while and it all seems re-learning. Been there,done that.
 

inglewoodpete

Senior Member
Isn't 0x3f shifted one left $7e? Still no worky
Is that initialisation code correct?
Please post a link to the datasheet of your i2c backpack.

I read your code, which specified $27 as the i2c address which, as I said, cannot work. I don't know where you plucked 0x3F from - it was not mentioned in your original post.

Forum members can't help you if you do not give clear information.
 

AllyCat

Senior Member
Hi,
Clearly I am doing something wrong.

hi2csetup i2cmaster,$27,i2cslow,i2cbyte ; set up i2c master for LCD
hi2cout 0,(254,128,255) ; move to start of first line
Can't say why the parallel mode didn't work because you've given us absolutely no details.

But the above can't possibly work. Firstly, as already said, the Slave Address must be an even number since the lsb (even/odd bit) is for Read/Write). Secondly, all the cheap "backpack" I2C LCDs use 4-bit data mode, so there's no point in sending 8-bit ASCII serial-type data to it. IWPs code uses 4-bit data with a parallel connection, which you might be able to convert to I2C. But there are several other threads on the forum which deal specifically with that type of display.

However, the I2C bus-search (and test) program can be found almost at the top of the CODE SNIPPETS section (note there's an update in post #4).

Cheers, Alan,
 
Last edited:

Steve2381

Senior Member
Eh?
Not using parallel mode. Binned that (I did say that in the original post) . Now trying some I2C LCD's.
All they have written on them is LCM1602. The address is not changeable (Googling that part shows variations with changeable addresses).
Have yet to find a datasheet. I have had these (new) displays a long while.

In mentioned in post #3 that I found the address 0x3F using a I2C scanner.
 

Attachments

Steve2381

Senior Member
The Picaxe I2C scanner you linked to AllyCat confirms its address 7e, so I have no idea why it doesn't respond.

I have 3 of these displays that were new and unopened. All three do not respond.
 

AllyCat

Senior Member
Hi,

Did you try putting "LCM1602 I2C" into the search box? For me that found THIS THREAD which explains why these displays are "difficult" to drive. But you'll find code from hippy that should work in post #28. But I'm sure that better threads have been written in the last 8 years. ;)

Cheers, Alan.
 

Steve2381

Senior Member
I did that. but never found that thread (I have about 25 windows open here).

With 7e as the address, the screen flashes then goes off. So it does appear to respond, but turns off the backlight somehow.
I am over them now. Don't really want to spend all evening working out the backlight issue.

Thanks for the assistance AllyCat, but I think these screens are destined for the bin. Far too long been spent on them already
 

Steve2381

Senior Member
I have fixed the backlight. No sure if these are going to be more hassle than they are worth however.
Thank you for your assistance
 

kfjl

Member
Hello,

Ages ago, I bought a couple of cheap, non-stupid lcd screens. I wired them up to see if they worked, and they did. I haven't touched them since.
One is with the backpack and is connected to a 08M2. The other is without the backpack and is connected to a 20X2.
Both are covered in dust but I just tried them out and they still work. The programs are attached.
If you have stuff to throw away, my middle name is Bin. :)
 

Attachments

stan74

Senior Member
You can erase picaxe chips and then they are the just pic chips. I did with a 28x2 and now it's a 18f25k22.
I got some salvaged 2 line displays...I think they use bulbs for back light. I hate binning stuff but got to.
Didn't bin my m20 picaxe or boards but other stuff to do...
like proper cheap displays
this was ages ago and hspi is sorted. They are more fun to use than 2 line lcds
 
Last edited:

Steve2381

Senior Member
Thanks. They are indeed.... in the bin. I have to start being ruthless with this rubbish I have collected over the years.
I have loads of displays, and you can buy them madly cheap now... so why spend all day getting difficult ones to work
 

mortifyu

New Member
Hi, only just saw this thread.

Here is some CODE that DOES work as I use it regularly with 20X4 LCD's with my own PCF8574T I2C interface circuitry which is effectively the same as the piggyback I2C interface shown in POST #8. The CODE is ALL credit to Hippy and a few other awesome peeps on this forum in past times.

Obviously change the ADDRESS of the LCD to whatever it actually is in your case.

Code:
#no_table
#no_data
#terminal 9600

init:

'I2C Communications Setup - LCD = $4E
HI2CSetup I2CMASTER, $4E, I2CFAST, I2CBYTE

'LCD Control BITS
Symbol bitRS = bit8
Symbol bitWR = bit9
Symbol bitE  = bit10
Symbol bitD4 = bit12
Symbol bitD5 = bit13
Symbol bitD6 = bit14
Symbol bitD7 = bit15
Symbol bitBL = bit11

'Initialize and setup LCD
b0 = $33 : Gosub SendB0AsInitByte
b0 = $32 : Gosub SendB0AsInitByte
b0 = $28 : Gosub SendB0AsCommandByte
b0 = $0C : Gosub SendB0AsCommandByte
b0 = $06 : Gosub SendB0AsCommandByte
b0 = $01 : Gosub SendB0AsCommandByte    'Clear Screen




main:

b0 = $81 : Gosub SendB0AsCommandByte    'Set cursor to Line 1, Col 6
for b3 = 0 to 17
    lookup b3,("PICAXE FORUM RULES"),b0
    Gosub SendB0AsDataByte
next b3

b0 = $C3 : Gosub SendB0AsCommandByte    'Set cursor to Line 1, Col 6
for b3 = 0 to 13
    lookup b3,("VOTE 1  HIPPY!"),b0
    Gosub SendB0AsDataByte
next b3

sertxd("Your LCD should now display:",cr,"LINE 1: PICAXE FORUM RULES",cr,"LINE 2:   VOTE 1  HIPPY!",cr,cr,"If it doesn't, be sure to try adjusting the CONTRAST with the BLUE potentiometer on your I2C piggyback board.",cr,cr,"Regards,",cr,"Mort.",cr,cr)

end


' *** LCD DATA Routines ***
SendB0AsInitByte:
Pause 15
bitBL = 1                          ' Turn Backlight ON
bitWR = 0                        ' Keep WR signal LOW

SendB0AsCommandByte:
bitRS = 0                        ' Send byte as a COMMAND

SendB0AsDataByte:
bitD4 = bit4                    ' Send msb first
bitD5 = bit5
bitD6 = bit6
bitD7 = bit7
bitE  = 1
b2 = b1                          ' b2 holds msb with E SET
bitE  = 0                         ' b1 holds msb with E CLEAR
HI2cOut [$4E], b1, ( b2, b1 )
bitD4 = bit0                    ' Send lsb second
bitD5 = bit1
bitD6 = bit2
bitD7 = bit3
bitE  = 1
b2 = b1    ' b2 holds lsb with E SET
bitE  = 0                        ' b1 holds lsb with E CLEAR
HI2cOut [$4E], b1, ( b2, b1 )
bitRS = 1                        ' Send data byte next time
Return

FYI, I copy/pasted the above CODE and programmed it straight into a 20X2 with a 20x4 LCD to confirm my example operates as expected.
This should operate fine with x 20X2 LCD also.

LCD Example Image
LCD Example.jpg

LCD Cursor positioning Map
LCD Hex locations.png




P.S. Don't give up mate... PICAXE RULES! Especially due to the fact that the HELP found here on this forum is SUPREME!


Regards,
Mort.
 

Steve2381

Senior Member
Thanks... I do have it working, but now the editor has failed again :mad:

I remember now why I abandoned my last Picaxe project. The Editor v6.1.0.0 suddenly decides it can't find any com ports.
Tested the 027 lead - that seems fine.

Refresh com ports in the editor and it instantly finds the Axe027 lead, but then reports cannot open com port.

It cannot find my breadboarded project, or my Axe091 board on any USB port on 3 different laptops. Nothing should have changed since I was programming it last night.

Not sure what else I can try. Checked all the drivers etc.

So, stuck with a half programmed 14m2 now with no other way of talking to it.

As a side note...
Is there a 'for sale' part to this forum? I would like to offload my stock of Picaxe chips to someone who may have more luck with them.
 

Steve2381

Senior Member
Why, when it finds and lists com port 6 in the top left settings window (or in fact, find whatever USB port I am trying), does it then report a totally different com port as 'unable to open' when I try to upload?

Why isn't it using the com port I have chosen (and there is only one) in the settings box top left? Maddening
 

Steve2381

Senior Member
EH????

Error: Incorrect hardware connected - PICAXE-08 v4.6 (expected PICAXE-14M2)

Yet its clearly a 14m2 in the project socket
 

Steve2381

Senior Member
Now it reports...

Error: Incorrect hardware connected - PICAXE-28X1 (40X1) vA.5 (expected PICAXE-14M2)

What causes it to see the wrong IC?
 

stan74

Senior Member
Maybe you forgot how to use picaxe, maybe chips us.
I got a component tester from fleabay and it is brill..even tests capacitor esr.
and it uses a coloured graphic display for £6.
2020 nearly over and sweating over 2line lcd...l8r
Get creative with a graphic display. they are so much more interesting.
look at this signal generator with 2 line display. pain to use
 
Last edited:

Steve2381

Senior Member
AAAHHHHHHHHH I HATE THIS EDITOR

It's the most unintuitive flawed bit of software ever. I HAVE COM 7 SELECTED, SO STOP TELLING YOU CAN'T OPEN COM PORT 6

Picaxe = Bin
 

Steve2381

Senior Member
OK. Life is too short and I have had a bad week.
Picaxe chips will be on Ebay tomorrow for anyone interested.

Axe027 lead binned and the Axe091 programming board hit the wall at 45mph.

Back to a far less frustrating Teensy
 

stan74

Senior Member
it's so long since using I don't understand port problem. Win com ports? You set it up correct?or don't care?
I found win ports change when using usb especially arduinos and clones so I find it odd but you always get a choice of 3 ports and one is correct.
 
Last edited by a moderator:

inglewoodpete

Senior Member
Everything is pointing towards bad connections.
OK. Life is too short and I have had a bad week.
Picaxe chips will be on Ebay tomorrow for anyone interested.

Axe027 lead binned and the Axe091 programming board hit the wall at 45mph.

Back to a far less frustrating Teensy
A word or two of thanks to the people who have spent the time to try and help you would be appreciated.

Good luck with your future endevours.
 

stan74

Senior Member
I just used the picace rs232 to 3.5 jack plug and never got port problems.
I've not binned it all and have erased picaxe chips and they work perfect as native pics...
Bit of a waste though I thought. 8bit chips are useful for lots of stuff,It's just what you want them to do...like work in your envirourment/ide/programmer. Why is is this a problem on so many systems? it can't always be user error...but usually is with me.
 

stan74

Senior Member
Everything is pointing towards bad connections.

A word or two of thanks to the people who have spent the time to try and help you would be appreciated.

Good luck with your future endevours.
Everything is pointing towards bad connections.

A word or two of thanks to the people who have spent the time to try and help you would be appreciated.

Good luck with your future endevours.
so long, and thanks for all the fish....hitch hikers guide to the galaxy
...like cheers for the help guys, you been brill.
I get your point and think you picaxe guys are very helpful same as other forums and I like to help even if no thank you.
some like to help and share..and thanks can mean a lot.
 
Top