Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Libray for character LCD modules (Busy flag/random pins)
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here
View previous topic :: View next topic  
Author Message
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Mon Sep 06, 2010 7:05 am    Post subject: Reply with quote

Hi,

Works here. (See attached picture).

Verify your hardware.

Best regards,

Luciano

Used code:
Code:
$regfile = "attiny2313.dat"
$crystal = 8000000
$lib "LUC_lcd4busy.lib"


Const _lcddb4_portx = Portd
Const _lcddb4_ddrx = Ddrd
Const _lcddb4_pinnumber = 2

Const _lcddb5_portx = Portd
Const _lcddb5_ddrx = Ddrd
Const _lcddb5_pinnumber = 5

Const _lcddb6_portx = Portd
Const _lcddb6_ddrx = Ddrd
Const _lcddb6_pinnumber = 4

Const _lcddb7_portx = Portd
Const _lcddb7_ddrx = Ddrd
Const _lcddb7_pinx = Pind
Const _lcddb7_pinnumber = 3

Const _lcde_portx = Portd
Const _lcde_ddrx = Ddrd
Const _lcde_pinnumber = 1

Const _lcdrw_portx = Portd
Const _lcdrw_ddrx = Ddrd
Const _lcdrw_pinnumber = 6

Const _lcdrs_portx = Portd
Const _lcdrs_ddrx = Ddrd
Const _lcdrs_pinnumber = 0

Config Lcd = 16 * 2
Cursor Off Noblink
Cls

Do

   Lcd "12345678"
   Locate 2 , 1
   Lcd "87654321"
   Waitms 1000
   Cls
   Waitms 500

Loop


End
Back to top
View user's profile
Ross_ValuSoft

Bascom Member



Joined: 20 Nov 2005
Posts: 275
Location: Melbourne, Australia

australia.gif
PostPosted: Tue Sep 07, 2010 2:35 am    Post subject: Reply with quote

Hello Luciano,

Completely unrelated ... why do you have wood in the sockets?

Cheers,

Ross
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Tue Sep 07, 2010 7:49 am    Post subject: Reply with quote

(This post is an out of topic).

* * *

Hi Ross,

The three attached pictures should be self-explanatory.

Note that this solution has an impact if you use a top adapter like the STK501.
(You will have to extend the length of the male header connectors of the STK50x adapters).

Best regards,

Luciano
Back to top
View user's profile
Aleksandr

Bascom Member



Joined: 29 Jul 2010
Posts: 15
Location: Russian Federation

russia.gif
PostPosted: Tue Sep 07, 2010 11:21 am    Post subject: Reply with quote

You need to use ZIF-socet.
Remove set socets, and solder ZIF.
Enough space for them?
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Tue Sep 07, 2010 12:42 pm    Post subject: Reply with quote

(This post is an out of topic).

* * *

There is no space for ZIF sockets. One ZIF will interfere with another
ZIF and the lever of the ZIF will interfere with the port headers or, if
you turn it, the lever will interfere with the jumpers or ISP headers of
the STK500.

(The gap space between the original DIP sockets of the STK500 is 4mm).

Best regards,

Luciano
Back to top
View user's profile
radciprian

Bascom Member



Joined: 23 Oct 2010
Posts: 8
Location: Cluj-Napoca, ROMANIA, EU

romania.gif
PostPosted: Sat Oct 23, 2010 10:40 pm    Post subject: LCD Problem Reply with quote

Hy Luciano, i have an EA W162B-BNLW LCD model 16x2 (http://www.lcd-module.de/pdf/doma/blueline-w.pdf). Datasheet tells me that the controller is HD44780. I have connected the LCD as follows:

LCD AVR ATMega8
' pin pin
' ============
' Db4 = PD3
' Db5 = PD2
' Db6 = PD1
' Db7 = PD0
' E = PD5
' RW = PD7 'Note that RW must be connected to a pin!
' RS = PD6

I used your library example (to try the busy flag) and other combinations to init the LCD but every time i get in the first row black boxes. I have also attached another LCD to the board an it's working well. This LCD does not want to init and i don't know what can be the problem.
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Sun Oct 24, 2010 10:43 am    Post subject: Reply with quote

Hi,

From the web page: LINK
The dot-matrix LCDs offered here are all equipped with
the HD 44780 controller or similar.


Open the datasheet of the controller chip soldered on your LCD module
and then verify if the initialization sequence and timing are compatible
with the initialization routine present in the file LUC_lcd4busy.lib.
If not, feel free to modify the code in the library.

My code was tested with an original Hitachi chip HD44780 and
other compatible chips.

Best regards,

Luciano
Back to top
View user's profile
radciprian

Bascom Member



Joined: 23 Oct 2010
Posts: 8
Location: Cluj-Napoca, ROMANIA, EU

romania.gif
PostPosted: Sun Oct 24, 2010 1:57 pm    Post subject: Reply with quote

Hi,

The controller is HD44780, but i cannot init the LCD, nothing appears on the rows. At full contrast the first row is black and nothing happens. After reset, there is a short changing in the intensity of light on LCD, but nothing happens. It's possible to need a negative voltage at contrast pin?

Here is the code

Code:

$regfile = "m8def.dat"
$crystal = 11059200
$hwstack = 32
$swstack = 16
$framesize = 40

$lib "LUC_lcd4busy.lib"

Const _lcddb4_portx = Portd                                                     'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcddb4_ddrx = Ddrd                                                       'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcddb4_pinnumber = 3                                                     'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.

Const _lcddb5_portx = Portd                                                     'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcddb5_ddrx = Ddrd                                                       'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcddb5_pinnumber = 2                                                     'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.

Const _lcddb6_portx = Portd                                                     'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcddb6_ddrx = Ddrd                                                       'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcddb6_pinnumber = 1                                                     'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.

Const _lcddb7_portx = Portd                                                     'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcddb7_ddrx = Ddrd                                                       'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcddb7_pinx = Pind                                                       'Valid values: PINA, PINB, PINC, PIND, PINE.
Const _lcddb7_pinnumber = 0                                                     'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.

Const _lcde_portx = Portd                                                       'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcde_ddrx = Ddrd                                                         'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcde_pinnumber = 5                                                       'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.

Const _lcdrw_portx = Portd                                                      'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcdrw_ddrx = Ddrd                                                        'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcdrw_pinnumber = 7                                                      'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.

Const _lcdrs_portx = Portd                                                      'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcdrs_ddrx = Ddrd                                                        'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcdrs_pinnumber = 6                                                      'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.

Config Lcd = 16 * 2

Cls

Waitms 1000

Lcd "1234567890"
Locate 2 , 1
Lcd "1234567890"

Do
 !NOP
Loop

End
 
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Sun Oct 24, 2010 3:35 pm    Post subject: Reply with quote

Hi,

Based on your question, I assume that your LCD not only doesn’t work with my library
but also with the standard LCD routines of Bascom. (CONFIG LCDPIN = PIN ....).

If this is the case, please open a new thread in the appropriate forum section.

Best regards,

Luciano
Back to top
View user's profile
sunmat

Bascom Member



Joined: 02 Nov 2010
Posts: 51

blank.gif
PostPosted: Wed Dec 08, 2010 7:32 am    Post subject: Proteus problem Reply with quote

Hi Luciano....

This is great code, THANK YOU.

Unfortune I can't test in real hardware yet, but I want to inform you that code is norking with in Proteus. I'm in office now, and can't send you code and project, but could you test in, and see where can be a problem.
As remember Proteus complain about sending command when LCD is still busy. And I see that MCU constantly sending some some data to LCD.
I connected RW pin regulary.

Regards!
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Wed Dec 08, 2010 5:42 pm    Post subject: Re: Proteus problem Reply with quote

sunmat wrote:
As remember Proteus complain about sending
command when LCD is still busy. And I see that
MCU constantly sending some some data to LCD.

Hi,

This is normal, the code in the LIB checks the busy flag of the LCD
over and over until it is cleared by the LCD. Have a look at the code
in the file LUC_lcd4busy.lib.

I am not a Proteus user.

Best regards,

Luciano
Back to top
View user's profile
sunmat

Bascom Member



Joined: 02 Nov 2010
Posts: 51

blank.gif
PostPosted: Wed Dec 08, 2010 7:49 pm    Post subject: .... Reply with quote

Quote:
I am not a Proteus user..

ccc Smile

I have fix a problem. So anyone who try this routines with Proteus have to change LCD clock from 240kHz to upper values. In my case to 1000kHz for 8Mhz CPU speed.
Back to top
View user's profile
sunmat

Bascom Member



Joined: 02 Nov 2010
Posts: 51

blank.gif
PostPosted: Wed Dec 08, 2010 8:32 pm    Post subject: DEL.... Reply with quote

Sometimes it is necessary to delete last character on LCD. Eg. in serial terminal when chr(Cool is received from PC.

Maybe you can add this feature to your LCD routines as option?
Example

Const DEL_enable=0 ' Valid values: 0,1
Const DEL_chr = 8 ' Valid values:0-255

Regards !
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Wed Dec 08, 2010 8:47 pm    Post subject: Reply with quote

Hi,

To delete one character, more characters or the last character, you
just need to use the Bascom command LOCATE to move the LCD
cursor to the desired location and then use LCD " " to send a space
character to the LCD which will override the character that need to be
deleted.

* * *

In my library are only low-level routines which are called
by the Bascom compiler.

Best regards,

Luciano
Back to top
View user's profile
sunmat

Bascom Member



Joined: 02 Nov 2010
Posts: 51

blank.gif
PostPosted: Wed Dec 08, 2010 9:02 pm    Post subject: ... Reply with quote

Quote:
...use the Bascom command LOCATE to move the LCD
cursor to the desired location and then use LCD " "...


Yes, I know that, but how to find out current LCD cursor Row and column location?

Confused
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5  Next
Page 4 of 5

 
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