Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

LCD 20*4, C2004A, on i2C. E, E1, E2 signals and PCF8574 prob
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
gpat

Bascom Member



Joined: 18 Apr 2006
Posts: 24

blank.gif
PostPosted: Thu Mar 07, 2013 1:14 pm    Post subject: LCD 20*4, C2004A, on i2C. E, E1, E2 signals and PCF8574 prob Reply with quote

Dear all
I just bought the LCD:
http://www.ebay.com/itm/180939111604?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

which has the LCD C2004A +PCF8574

with
PIN ASSIGNMENT / PIN SYMBOL FUNCTION
1 Vss Power Supply (0V)
2 Vdd Power Supply (+5V)
3 Vo Contrast Adjust
4 RS Data/Instruction Register Select
5 R/W Read/Write
6 E Enable Signal
7~14 DBO~DB7 Data bus Line
15 A Power Supply for LED BL (+)
16 K Power Supply for LED BL (-)

I disconnected the PCF 8574 from the LCD board and works fine with 4pin mode.
I cant operate it with the I2C and PCF8574.


As I can see in the lcd_i2c.lib we need pins E1 and E2 (?) as seen in the
AN #118 - I2C LCD and Keboard library example ( http://www.mcselec.com/index.php?option=com_content&task=view&id=82&Itemid=57)
since
P6 of PCF8574 is connected to LCD-E2
P7 of PCF8574 is connected to LCD-E1

But the LCD has only one Enable signal.
What is your suggestion? concerning the E,E1,E2 signals




PS: Don't buy this LCD, since the pinout is different than the normally used pinout of PCF8574+LCD in Bascom, which I had to change also, but I dont know what to connect to E....
(BASCOM-AVR version : 2.0.7.3 , Latest : 2.0.7.6 )
Back to top
View user's profile
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Thu Mar 07, 2013 10:00 pm    Post subject: Reply with quote

Hi,
Check pins on I2c board to lcd it may NOT be same setup as used in Lcd_i2c

as I see 8574 pins to lcd is NOT same layout pin by pin !!

8574 pin 12 is data7 (pin 14 lcd)
8574 pin 11 is data6 (pin 13 lcd)
ect
see i2c to lcd interface.pdf in AN #118 for pins
LCD- E1 (or E on 1 and 2 line LCD) use P7 for 2 line

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
gpat

Bascom Member



Joined: 18 Apr 2006
Posts: 24

blank.gif
PostPosted: Fri Mar 08, 2013 8:29 am    Post subject: Reply with quote

kimmi wrote:
Hi,
Check pins on I2c board to lcd it may NOT be same setup as used in Lcd_i2c

as I see 8574 pins to lcd is NOT same layout pin by pin !!

8574 pin 12 is data7 (pin 14 lcd)
8574 pin 11 is data6 (pin 13 lcd)
ect
see i2c to lcd interface.pdf in AN #118 for pins
LCD- E1 (or E on 1 and 2 line LCD) use P7 for 2 line


Thanks kimmi for your time.
Well of course the pinout is not the same as described in Lcd_i2c. I already changed the circuit with proper pins according to the library
I didnt understand your point for the E

Lcd_i2c. describes :
8574 P6 -> E2 (on 1 or 2 line display nc)
8574 P7 -> E1

But my LCD has only E.
What am I missing?
Or if you think that is not possible to implement this LCD, tell me to quit efforts and suggest me an LCD that will work with Bascom ->I2C, if possible from Ebay
Really thanks for your time

And something else
I have already made a program >2000lines comments blanks etc.
Its hard to find something inside...
Can we brake a *.bas file to several and combine them together in the main program? (like we do in vb, classes, modules etc....)

George
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Fri Mar 08, 2013 8:54 am    Post subject: Reply with quote

Hello gpat

"Can we brake a *.bas file to several and combine them together in the main program?"

Yes bascom has a project mode where you can put all your sub's ect into seperate files then with an $include it brings them in have a look at my ENC28J60 webserver project in the blog section its over 10000 lines long.

Regards Paul
Back to top
View user's profile
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Fri Mar 08, 2013 10:07 am    Post subject: Reply with quote

Quote:
Lcd_i2c. describes :
8574 P6 -> E2 (on 1 or 2 line display nc)
8574 P7 -> E1

But my LCD has only E.
What am I missing?

you missing the NC
8574 P6 -> E2 (on a lcd with one or two line display nc) >> NC (no connect)
8574 P7 -> E1 (or to E on a lcd with one or two line LCD) you have 2 line use P7

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
gpat

Bascom Member



Joined: 18 Apr 2006
Posts: 24

blank.gif
PostPosted: Fri Mar 08, 2013 4:51 pm    Post subject: Reply with quote

Thank you all.
I will check them out the next days
George
Back to top
View user's profile
vvogeley

Bascom Member



Joined: 20 Feb 2008
Posts: 8

blank.gif
PostPosted: Sat Mar 09, 2013 11:03 am    Post subject: Reply with quote

Hi gpat,

here is a link to a german Bascom forum
http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=10904&highlight=i2c+lcd

with this lib (Lcd_i2c_v2.lib) you can define every PCF8574 pin .
look here:
Code:

Const Pcf_d4 = 4
Const Pcf_d5 = 5
Const Pcf_d6 = 6
Const Pcf_d7 = 7
Const Pcf_rs = 0
Const Pcf_rw = 1
Const Pcf_e2 = 3
Const Pcf_e1 = 2
 


I hope this help you.

best regards
Volker
Back to top
View user's profile
vvogeley

Bascom Member



Joined: 20 Feb 2008
Posts: 8

blank.gif
PostPosted: Sat Mar 09, 2013 5:57 pm    Post subject: Reply with quote

Sorry, now the correct link

http://bascomforum.de/

best regards
Volker
Back to top
View user's profile
aphawk

Bascom Member



Joined: 23 Jan 2010
Posts: 175
Location: Brazil

brazil.gif
PostPosted: Tue Jul 16, 2013 3:39 pm    Post subject: Reply with quote

I see in the German Bascom Forum that someone make modifications in the lcd_i2c_v2.lib, creating the lcd_i2c_v3.lib, that can control the backlite if I use only 4 bits mode and R/W tied to ground. This is very interesting !

But I can't understand German, and using only the Google Translate is very difficult to get the code and the new library.

Maybe someone that is fluent in both German and English can post here this new library, with the example code ?

Thanks !

Paulo
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Mon Jul 22, 2013 7:31 pm    Post subject: Reply with quote

Library, example code and Proteus design in archive. But it don't work.
I tried first version from AN#118, second from Ludwig and this with 16x2, 40x2, 20x4 LCD. In Proteus and hardware, but nothing. Init display, cursor is shown, text not shown.
I don't know what's wrong...
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2335

blank.gif
PostPosted: Tue Jul 23, 2013 11:23 am    Post subject: Reply with quote

Mrshilov wrote:
Library, example code and Proteus design in archive. But it don't work.


Hmmm, had a look, but just to make sure: do you refer to the original topic about the arduino lcd extension with the ebay link?

Well, concerning the v3-lib, the type of code the guy wrote is really not my style and comments in German in an international used lib are imho completely clueless.
While comments describing an opcode and rather not what's the purpose of the code, aren't already pretty smart. LOL

I refer therefore to the lib with my mod, which was nothing else than twisting bits, it's name in my lib-directory here is: lcd_i2c.lib

Looking through arduino-docs, especially for LiquidCrystal_I2C.h/cpp, connections for the arduino-I2C-extension are made as follows:

Pcf P0 -> D4
Pcf P1 -> D5
Pcf P2 -> D6
Pcf P3 -> D7
Pcf P4 -> En
Pcf P5 -> R/W
Pcf P6 -> Rs
Pcf P7 -> Backlight

And that doesn't match your code.
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Tue Jul 23, 2013 3:59 pm    Post subject: Reply with quote

I check this in non-arduino LCDs and non-Arduino PCF8574 plate. Maybe Proteus model of PCF8574 is not fully correct, but in hardware don't work too. Chipsets of LCDs is unknown (compound drop), but while connected wia 4- or 8-bit directly to controller they works fine like HD44780 & KS0066 compatible.
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2335

blank.gif
PostPosted: Tue Jul 23, 2013 7:34 pm    Post subject: Reply with quote

Mrshilov wrote:
I check this in non-arduino LCDs and non-Arduino PCF8574 plate.

And how would I know that? Evil or Very Mad

Connections are then like described in your code?

Here you're configuring soft I2C-clock speed:
Code:
Config I2cdelay = 1

From the help:
Quote:
When you use a very low crystal frequency, it is not possible to work with high clock frequencies.

A value of 1 means that's what you try to do.

Why you connect the expander to the hardware I2C-pins, while using soft-I2C?
External pullups are connected?
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Tue Jul 23, 2013 9:16 pm    Post subject: Reply with quote

External pullup, of course, connected.
I use hardware I2C-pins because I try hardware and software I2C. In both cases PCF8574 works, display is inits and cursor is shown.
I try without I2C delay and with it from 1 to 30.
Note! Without string "Display On" cursor is not shown. In all examples I don't see this string.
Mr. MWS! Code is very simple and Proteus design is in archive. Please, make it work. It will be more informative for me.
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2335

blank.gif
PostPosted: Tue Jul 23, 2013 11:59 pm    Post subject: Reply with quote

Neither I do have nor use Proteus.
Don't see your code in front of me now, so I'm not sure, if you already use Init LCD, in case not, try to issue some Wait an then InitLCD, maybe the hardware needs more time to get ready.
Did you double-check the actual clock frequency of the ATM32 against the code? In case this is wrong, timing for the display is not correct. Why it would work then without expander, would be the next question then.
Basically I see nothing wrong in the lcd_i2c.lib, others have used it successfully.
About the v3-lib I can't and won't tell anything.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum