BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 8:27 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Request LCD programming examples.
PostPosted: Sun Apr 10, 2011 8:11 pm 
Offline
New User

Joined: Mon Apr 04, 2011 7:53 am
Posts: 4
Location: In the Land of Oz! (Kansas)
I would like to request MBasic code examples inplementing some LCD commands that are not well described in the 'manual'.
My hardware: BAP 28 and a BasicATOM Lab Board with a 2x16 LCD.

Examples desired: Auto increment/decrement display, move cursor to a location and delete or replace the character at that location
and how to scroll the displayed text.

I am trying to understand the LCD commands so I can display various information from a Pocket Watch B module.

I have been able to 'puzzle out' most of the commands, but not others. I am just an old guy 'playing' with electronics.

If anyone is interested, I have written a program that uses a Pocket Watch B module astable-alarm
to start a 'cylon eye' using a 10-LED bar module. Will post upon request.

Below is 'code' that I have been able to implement and understand. Thanks in advance for any help you provide!
==================================================================================
;DEMO PROGRAM - LCDINIT.BAS
' wait for LCD to power up
Pause 500
' initialize LCD
lcdinit p0\p1\p7\p6\p5\p4,p2
' turn LCD Backlight ON
high p3
' write some text to 2x16 LCD, fills both lines
lcdwrite p0\p1\p7\p6\p5\p4,[$101,$102,$10C,$128,"Hello World! PLF",scrram+64,"I Love You Dixie"]
'
temp var byte ' counter variable for memory locations
character var byte(16) ' array variable to hold results of LCD_Read command
'
for temp = 0 to 15 ' read line 1 loop
lcdread p0\p1\p7\p6\p5\p4,p2,temp,[character(temp)] ' read LCD line 1 memory locations
serout s_out, i9600,[character(temp)] ' output memory locations to terminal window to verify reads
next
'
serout s_out, i9600,[13,"================",13] ' line to separate LCD_Read results
'
for temp = 64 to 79 ' read line 2 loop
lcdread p0\p1\p7\p6\p5\p4,p2,temp,[character(temp)] ' read LCD line 2 memory locations
serout s_out, i9600,[character(temp)] ' output memory locations to terminal window to verify reads
next
'
end
==================================================================================


Top
 Profile  
 
 Post subject: Re: Request LCD programming examples.
PostPosted: Tue Apr 12, 2011 9:34 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
There are predefined constants for all the Hitachi LCD builtin commands as listed on page 139 of the new manual(you should get the lastest version of Studio or download the manual from the download section). To move the cursor to a new place you use scrram + address. This is also described in the LCDWRITE command section of the manual on page 140. Once you have moved the cursor you can overwrite the character that was previously at that location.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Request LCD programming examples.
PostPosted: Fri Apr 15, 2011 12:03 pm 
Offline
New User

Joined: Mon Apr 04, 2011 7:53 am
Posts: 4
Location: In the Land of Oz! (Kansas)
I am a returning customer. I have a significant amount invested in your products, ie. boards and modules.

After my recent order upgrading a lab board, I downloaded and installed the latest studio and manual.

See my post in Feedback: "BasicATOM Lab Board missing JP4 Servo Power header."

I have spent a considerable amount of time reading 'forum posts' and studying the manual BEFORE asking for help.

Regarding your reference to page 139 of the manual, the code example is incorrect.

Partial copy --> lcdwrite p0\p1\p7\p6\p5\p4,p2, [CLEARLCD,HOMELCD,SCR,TWOLINE,”Hello World”]
Should be --> [LCDCLEAR,LCDHOME . . . ]

Since I cannot trust the examples in the 'new' manual I have requested help.

I have also found another command where the explanation is either incorrect or not explained properly.
(I figured a work-a-round for that one.)

Have I requested something that is beyond the scope of this forum?

Have I wasted my money investing in these products?

Should I cut my losses and invest in other products?

_________________
Paul
In the Land of Oz. . .
Just South of the
Yellow Brick Road!


Top
 Profile  
 
 Post subject: Re: Request LCD programming examples.
PostPosted: Fri Apr 15, 2011 8:17 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Both versions of the constants are in the latest releases of Studio.

CLEARLCD,HOMELCD and LCDCLEAR,LCDHOME

What version of Studio are you using?

Also what was the other command you found was either incorrect or not explained properly?

Also even in older versions of studio you can create your own LCD commands(eg they are passed as commands and not text. By looking at the Hitachi LCD reference and adding 0x100 to the command value in the Hitachi reference you can create all the commands. Any value less than 0x100 will be sent as plain text and other values will be sent as a command to the LCD.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Request LCD programming examples.
PostPosted: Mon Apr 25, 2011 10:26 am 
Offline
New User

Joined: Mon Apr 04, 2011 7:53 am
Posts: 4
Location: In the Land of Oz! (Kansas)
Studio ver 2.0.0.9
manual ver 2

Yes, both versions of the commands work but type both in and see how Studio color codes the commands and you will see what I am referring to. Is confusing when Studio is not consistent.

My mistake about other command. I was not implementing it properly.

Thanks for the explanation on way to send commands, this will help. Maybe

_________________
Paul
In the Land of Oz. . .
Just South of the
Yellow Brick Road!


Top
 Profile  
 
 Post subject: Re: Request LCD programming examples.
PostPosted: Mon Apr 25, 2011 8:20 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
I'll make sure to add them to the color list in Studio.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO