View previous topic :: View next topic |
Author |
Message |
DEAFBOY
Joined: 01 Sep 2011 Posts: 23
|
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Wed Mar 07, 2012 3:13 pm Post subject: |
|
|
From the datasheet it's pretty clear what to do, would give this a try:
Code: | !LDI R24 , &h42
!call _Lcd_control
!LDI R24 , &h10
!call _Write_lcd
Waitms 500
!LDI R24 , &h42
!call _Lcd_control
!LDI R24 , &h00
!call _Write_lcd
Waitms 500 |
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Mar 07, 2012 3:58 pm Post subject: |
|
|
i see the help is missing some info.
lcdcmd value ' will call _lcd_control
lcddata value 'will call _write_lcd
this does not require asm. _________________ Mark |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Wed Mar 07, 2012 9:20 pm Post subject: |
|
|
albertsm wrote: | i see the help is missing some info.
lcdcmd value ' will call _lcd_control
lcddata value 'will call _write_lcd
this does not require asm. |
Yes, did not find it, so I dug the appropriate routines out of a lib. Not much ASM anyway. |
|
Back to top |
|
|
DEAFBOY
Joined: 01 Sep 2011 Posts: 23
|
Posted: Fri Mar 09, 2012 2:53 pm Post subject: |
|
|
MWS wrote: | From the datasheet it's pretty clear what to do, would give this a try:
Code: | !LDI R24 , &h42
!call _Lcd_control
!LDI R24 , &h10
!call _Write_lcd
Waitms 500
!LDI R24 , &h42
!call _Lcd_control
!LDI R24 , &h00
!call _Write_lcd
Waitms 500 |
| Hmm, how do I use without a Lib?
Why is it so complicated?
Code: | $regfile = "m32def.dat"
$crystal = 4000000
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , Rs = Porta.0 , E = Porta.1
Config Lcd = 20 * 4a , Chipset = Ks077
Cursor Off Noblink
Rs Alias Porta.0
E Alias Porta.1
Declare Sub Lcdinit
Declare Sub Lcdwrite(byval Db As Byte)
Declare Sub Letter_blinking
Cls
Call Lcdinit
Call Letter_blinking
Locate 1 , 1 : Lcd "Letter blinking"
End
'-------------------------------------------------------------------------------
Sub Lcdwrite(byval Db As Byte)
'set upper nibble
If Db.4 = 1 Then Portc.0 = 1 Else Portc.0 = 0
If Db.5 = 1 Then Portc.1 = 1 Else Portc.1 = 0
If Db.6 = 1 Then Portc.2 = 1 Else Portc.2 = 0
If Db.7 = 1 Then Portc.3 = 1 Else Portc.3 = 0
'send upper nibble
E = 1 'Set E
Waitms 5
E = 0 'Reset E
Waitms 5
'set lower nibble
If Db.0 = 1 Then Portc.0 = 1 Else Portc.0 = 0
If Db.1 = 1 Then Portc.1 = 1 Else Portc.1 = 0
If Db.2 = 1 Then Portc.2 = 1 Else Portc.2 = 0
If Db.3 = 1 Then Portc.3 = 1 Else Portc.3 = 0
'send lower nibble
E = 1 'Set E
Waitms 5
E = 0 'Reset E
Waitms 5
End Sub
'-------------------------------------------------------------------------------
Sub Lcdinit
Call Lcdwrite(&H30) : Waitus 40 'Function Set
Call Lcdwrite(&H06) : Waitus 40 'Entry Mode Set
Call Lcdwrite(&H36) : Waitus 40 'Function Set
Call Lcdwrite(&H09) : Waitus 40 'ext. Function Set
Call Lcdwrite(&H40) : Waitus 40 'Set SEGRAM
Set Rs : Waitms 5 'Set RS
Call Lcdwrite(&H00) : Waitus 50 'Write Data
Reset Rs : Waitms 5 'Reset RS
Call Lcdwrite(&H30) : Waitus 40 'Function Set
Call Lcdwrite(&H0f) : Waitus 40 'Display ON/OFF
Call Lcdwrite(&H01) : Waitms 2 'Clear Display
End Sub
Sub Letter_blinking
Call Lcdwrite(&H36) : Waitms 5 'Function Set
Call Lcdwrite(&H42) : Waitms 5 'Set Letter-Icon
Set Rs : Waitms 5 'Set RS
Call Lcdwrite(&H50) : Waitms 5 'Icon blinking
Reset Rs : Waitms 5 'Reset RS
Call Lcdwrite(&H30) : Waitms 5 'Function Set
Call Lcdwrite(&H80) : Waitms 5 'Set DDRAM adr
End Sub
'------------------------------------------------------------------------------- |
_________________ http://www.christian-elektronik.de/ |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Mar 09, 2012 3:52 pm Post subject: |
|
|
DEAFBOY wrote: | Hmm, how do I use without a Lib? |
The calls I've mentioned are standard-labels which exist as soon you tell Bascom that you use a display. So extra/special libs will of course use these names, for the reason to have a standard interface. But drivers for common used lcd-controllers are included into the compiler, so you won't need an extra lib.
Mark wrote you that Basic clear names are available, so you do not even need ASM- calls, you can use lcdcmd and lcddata. Obviously lcdcmd sends a command byte, while lcddata sends a data byte to the display.
Quote: | Why is it so complicated? |
Because you make it that complicated ?
From your first post it looked like the display works with the standard config lcd settings. You only did not seem to understand how to control the icons, which btw. are not a lcd standard, instead very specific to that exact display.
Now, why did you create that bunch of code ? And, your message leaves the question open: does it finally work ?
Wondering why this should work, from your code:
Code: | Call Lcdwrite(&H36) : Waitus 40 'Function Set |
You did copy the initialization sequence from the datasheet, but you did not consider the headline over this sequence:
Quote: | INITIALISIERUNGSBEISPIEL FÜR DEN 8-BIT MODUS |
If you'd had all 8 data lines connected, you'd use the 8bit-mode, but as there are only 4, it's the 4bit mode, therefore the command would be &h26 "0 0 1 DL N RE DH REV" , instead of &h36.
Looking at the datasheet, under "ANSTEUERUNG DER SYMBOLE" there's a sequence, which does not exactly fit your setup, also because it's for 8bit data length. As the Bascom driver should handle that, I either would leave completely out this command, or in case the display expects it, I'd send the &h26 command.
Then you have to send the SEGRAM address for the specific icon with "lcdcmd", for the letter symbol it's &h40 for the function "Set SEGRAM adr" and &h02 for the letter symbol, together = &h42. After that you need to send data with "lcddata ", it's &h10 for showing the symbol, &h00 or clearing and &h50 for blinking it. About this way, and here I have added the 4bit-function set:
Code: | lcdcmd &h26 : waitms 1
lcdcmd &h42 : waitms 1
lcddata &h10 : waitms 1
lcdcmd &h26 : waitms 1 |
Did you try that ?
And, maybe a bit OT: why did you address Bascom forum before responding to the help given here? Not that you wouldn't be free to, but its rather bad behavior not to respond to those willing to help you, instead turn away.
Just wondering. |
|
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
|
|