View previous topic :: View next topic |
Author |
Message |
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Tue Aug 03, 2010 7:26 am Post subject: |
|
|
Hi,
The LUC_lcd4busy.lib was successfully used with an ATmega48, ATmega168,
ATmega16, ATmega32, ATmega128.
* * *
Test first your LCD module with the standard routines of Bascom. (CONFIG LCDPIN = PIN ....).
When you do that, make sure the R/W pin of the LCD is permanently connected to ground.
When the LCD module works with the standard routines of Bascom, then go back
to the LUC_lcd4busy.lib and connect again the R/W line to the ATmega8.
* * *
Which version of the Bascom compiler are you using?
Best regards,
Luciano |
|
Back to top |
|
|
Aleksandr
Joined: 29 Jul 2010 Posts: 15 Location: Russian Federation
|
Posted: Tue Aug 03, 2010 1:05 pm Post subject: |
|
|
Mr.Luciano, I have 3 modules LCD, 2 LCD 1602A and 1 1602H.
All LCD, have been checked up on ATTyny2313 with "lcd4.lbx",
In standard for Bascom configurations. All LCD works.
p.s. I use the compiler of version 1.11.9.8
Best regards |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Tue Aug 03, 2010 4:26 pm Post subject: |
|
|
Hi,
Try the code below.
(Two configuration statements were added to your sample code).
Read also this post about BUS mode: LINK
Best regards,
Luciano
Code: | $regfile = "m8def.dat"
$crystal = 8000000
$hwstack = 64
$swstack = 40
$framesize = 40
Dim X As Byte
Config LCDMODE = BUS
Config LCDBUS = 4
$lib "LUC_lcd4busy.lib"
Const _lcddb4_portx = Portb 'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcddb4_ddrx = Ddrb 'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcddb4_pinnumber = 0 '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 = 7 '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 = 6 '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 = 5 '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 = 1 'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.
Const _lcdrw_portx = Portb 'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcdrw_ddrx = Ddrb 'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcdrw_pinnumber = 3 'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.
Const _lcdrs_portx = Portb 'Valid values: PORTA, PORTB, PORTC, PORTD, PORTE.
Const _lcdrs_ddrx = Ddrb 'Valid values: DDRA, DDRB, DDRC, DDRD, DDRE.
Const _lcdrs_pinnumber = 2 'Valid values: 0, 1, 2, 3, 4, 5, 6, 7.
Config Lcd = 16 * 2
Cursor Off Noblink
Main:
Cls
Lcd "Line 1 890123456"
Locate 2 , 1
Lcd "Line 2 890123456"
Waitms 2000
Goto Main
End |
|
|
Back to top |
|
|
Aleksandr
Joined: 29 Jul 2010 Posts: 15 Location: Russian Federation
|
Posted: Mon Aug 09, 2010 1:20 pm Post subject: |
|
|
Mr. Luciano, so too does not work.
The only thing that has changed, on LCD points, brackets and other dust
There can be you have an opportunity to test on Mega8? |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Mon Aug 09, 2010 5:34 pm Post subject: |
|
|
Hi,
I don't have here an ATmega 8 so today I have ordered two chips
ATmega8 an two chips ATmega8A. I will let you know the results
as soon as I receive the chips.
Best regards,
Luciano |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Fri Aug 13, 2010 9:23 am Post subject: |
|
|
Hi,
Works OK here with an ATmega8. See attached pictures and attached HEX file.
Try to program your ATmega8 chip with my HEX file. If it does not work, then
verify your hardware.
Best regards,
Luciano
Used code: (The attached HEX file).
Code: | $regfile = "m8def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 16
$framesize = 40
$lib "LUC_lcd4busy.lib"
Config LCDMODE = BUS ' This will reduce the program space used
Config LCDBUS = 4 ' by the Bascom initialization code.
' LCD ATmega8
' pin pin
' ============
' Db4 = PB0
' Db5 = PD7
' Db6 = PD6
' Db7 = PD5
' E = PD1
' RW = PB3
' RS = PB2
'
' These are the 22 constants for the above connections:
Const _lcddb4_portx = Portb
Const _lcddb4_ddrx = Ddrb
Const _lcddb4_pinnumber = 0
Const _lcddb5_portx = Portd
Const _lcddb5_ddrx = Ddrd
Const _lcddb5_pinnumber = 7
Const _lcddb6_portx = Portd
Const _lcddb6_ddrx = Ddrd
Const _lcddb6_pinnumber = 6
Const _lcddb7_portx = Portd
Const _lcddb7_ddrx = Ddrd
Const _lcddb7_pinx = Pind
Const _lcddb7_pinnumber = 5
Const _lcde_portx = Portd
Const _lcde_ddrx = Ddrd
Const _lcde_pinnumber = 1
Const _lcdrw_portx = Portb
Const _lcdrw_ddrx = Ddrb
Const _lcdrw_pinnumber = 3
Const _lcdrs_portx = Portb
Const _lcdrs_ddrx = Ddrb
Const _lcdrs_pinnumber = 2
Config Lcd = 16 * 2
Cursor Off Noblink
Do
Cls
Waitms 1000
Lcd "Line 1 890123456"
Locate 2 , 1
Lcd "Line 2 890123456"
Waitms 1000
Loop
End |
|
|
Back to top |
|
|
Aleksandr
Joined: 29 Jul 2010 Posts: 15 Location: Russian Federation
|
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Sun Aug 15, 2010 7:20 pm Post subject: |
|
|
Hi,
Increase the contrast and see if the LCD is initialized for two lines or just one line.
Best regards,
Luciano |
|
Back to top |
|
|
Aleksandr
Joined: 29 Jul 2010 Posts: 15 Location: Russian Federation
|
Posted: Sun Aug 15, 2010 8:00 pm Post subject: |
|
|
Second line not work.
Tomorrow I shall order new LCD, and I shall try.
Something inside me speaks: that LCD is dead |
|
Back to top |
|
|
Aleksandr
Joined: 29 Jul 2010 Posts: 15 Location: Russian Federation
|
Posted: Tue Aug 17, 2010 8:38 am Post subject: |
|
|
mr. Luciano!
I have removed 2 lines in my code:
Code: |
'Config Lcdmode = Bus
'Config Lcdbus = 4
|
and then all has started.
Many thanks for the help!
Last edited by Aleksandr on Tue Aug 17, 2010 11:51 am; edited 1 time in total |
|
Back to top |
|
|
Aleksandr
Joined: 29 Jul 2010 Posts: 15 Location: Russian Federation
|
Posted: Tue Aug 17, 2010 11:44 am Post subject: |
|
|
Its i again ))
One more problem.
After power on, only one line works .
If i reset chip, two lines are started. |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Tue Aug 17, 2010 3:42 pm Post subject: |
|
|
Via fuse bytes you can program a delay after reset or power-up.
The delay can be 0 ms, 4.1 ms or 65 ms. Try with 65 ms.
With this delay you will make sure that the power supply voltage
has reached 5V and that the LCD controller chip present on the LCD
module is ready to receive the data from the AVR.
If that doesn't help, then use the Bascom command INITLCD.
Best regards,
Luciano |
|
Back to top |
|
|
Aleksandr
Joined: 29 Jul 2010 Posts: 15 Location: Russian Federation
|
Posted: Sun Aug 22, 2010 8:11 pm Post subject: |
|
|
Thanks, mr. Luciano!
All my LCD is work!
i use INITLCD.
Code: |
$regfile = "m8def.dat"
$crystal = 8000000
$lib "LUC_lcd4busy.lib"
Const _lcddb4_portx = Portd
Const _lcddb4_ddrx = Ddrd
Const _lcddb4_pinnumber = 3
Const _lcddb5_portx = Portd
Const _lcddb5_ddrx = Ddrd
Const _lcddb5_pinnumber = 2
Const _lcddb6_portx = Portd
Const _lcddb6_ddrx = Ddrd
Const _lcddb6_pinnumber = 1
Const _lcddb7_portx = Portd
Const _lcddb7_ddrx = Ddrd
Const _lcddb7_pinx = Pind
Const _lcddb7_pinnumber = 0
Const _lcde_portx = Portd
Const _lcde_ddrx = Ddrd
Const _lcde_pinnumber = 4
Const _lcdrw_portx = Portd
Const _lcdrw_ddrx = Ddrd
Const _lcdrw_pinnumber = 5
Const _lcdrs_portx = Portd
Const _lcdrs_ddrx = Ddrd
Const _lcdrs_pinnumber = 6
Config Lcd = 16 * 2
Initlcd
Cursor Off Noblink
Main:
Cls
Waitms 500
Lcd "12345678980"
Locate 2 , 1
Lcd "12345678980"
Waitms 500
Goto Main
|
|
|
Back to top |
|
|
Aleksandr
Joined: 29 Jul 2010 Posts: 15 Location: Russian Federation
|
Posted: Fri Aug 27, 2010 6:32 pm Post subject: |
|
|
Mr.Lachano!
I liked yours idea be relative "LUC_lcd4busy.lib"
May be, you can write new library for buttons?
The requirement: used any pin any quantity of buttons in the keyboard ((an example: for me 6 buttons necessary only => 2 rows and 3 lines or 3 rows and 2 lines)
The rest pins are not necessary
With the best regards,
Aleksandr. |
|
Back to top |
|
|
Aleksandr
Joined: 29 Jul 2010 Posts: 15 Location: Russian Federation
|
|
Back to top |
|
|
|
|
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
|
|