Displaying variables on a parallel LCD
Archiver
Posts: 46,084
Hi all,
I'm trying to display the distance variable returned from my SRF04 sonar
module on to a parallel lcd with a BS2.
When I try all I get is 3 black boxes and I tried the contrast but that
wasn't it. Heres my code:
Wdist var word
Main:
Gosub SR_Sonar
For index = 0 to 2
Read wdist + index,char
Gosub LCDWR
next
Pause 500
Goto main
Don't worry I have my initialization code and the sub commands for the
sonar and LCD. I have been working on this for months to no avail.
Thanks in advance.
-Mike
[noparse][[/noparse]Non-text portions of this message have been removed]
I'm trying to display the distance variable returned from my SRF04 sonar
module on to a parallel lcd with a BS2.
When I try all I get is 3 black boxes and I tried the contrast but that
wasn't it. Heres my code:
Wdist var word
Main:
Gosub SR_Sonar
For index = 0 to 2
Read wdist + index,char
Gosub LCDWR
next
Pause 500
Goto main
Don't worry I have my initialization code and the sub commands for the
sonar and LCD. I have been working on this for months to no avail.
Thanks in advance.
-Mike
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
What's in the init code? What's in LCDWR (sounds familiar)?
Is char an ASCII character or a digit? Either way I'd think you'd see
something. A few LCDs require a negative contrast voltage. Are you sure
the LCD you have is Hitachi-compatible?
Need more info to help on this one.
Al Williams
AWC
*NEW KITS: http://www.al-williams.com/kits.htm
>
Original Message
> From: Mike Dillon [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=K8iPvRWVBMJM9GpMEoWIsev4aGE-nCCLSKH-Wybey6yQzuVQtfdYmHiILYVkRSt660UTq3hvqGsE8dd3IBzcwGo]laxboy687@e...[/url
> Sent: Saturday, May 03, 2003 6:08 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Displaying variables on a parallel LCD
>
>
> Hi all,
> I'm trying to display the distance variable returned from my
> SRF04 sonar module on to a parallel lcd with a BS2. When I
> try all I get is 3 black boxes and I tried the contrast but
> that wasn't it. Heres my code:
>
> Wdist var word
>
> Main:
> Gosub SR_Sonar
> For index = 0 to 2
> Read wdist + index,char
> Gosub LCDWR
> next
> Pause 500
> Goto main
>
>
> Don't worry I have my initialization code and the sub
> commands for the sonar and LCD. I have been working on this
> for months to no avail. Thanks in advance.
>
> -Mike
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
The LCD displays print and numbers fine because I have it display a
message from the EEPROM stored right before it displays the sonar
output. It is Hitachi-compatible but sometimes I will get and ASCII if I
tell the sonar
To write the wdist to the EEPROM and then read the address but even then
it isn't consistent when I tell the debug to display the memory
location.
Here is the entire code:
RS con 4
E con 5
INIT con 8
ECHO con 9
ClrLCD con $01
CrsrHM con $02
Char var byte
Index var byte
Wdist var word
Msg DATA "Sonar Demo "
Convfac con 29 'converts to centimeters
LCDinit: DirL = %00111111
Outs = %0000
LCDinit1:
Pause 500
Outa = %0011
Pulsout E, 1
Pause 5
Pulsout E, 1
Pulsout E, 1
Outa = %0010
Pulaout E, 1
Char = %00001100
Gosub LCDCMD
Char = %00000110
Gosub LCDCMD
Char = Clrlcd
Gosub LCDCMD
Char = CRSRHM
Gosub LCDCMD
Start:
For index = 0 to 15
Read msg + index,char
Gosub LCDWR
Pause 5
NEXT
Pause 1000
Main:
Gosub SR_sonar
For Index = 0 to 2
Read wdist + index, char
Gosub LCDWR
Pause 5
Next
Pause 500
Goto main
LCDCMD:
Low RS
LCDWR:
Outa = char.Highnib
Pulsout E, 1
Outa = char.lownib
Pulsout E, 1
High RS
Return
SR_Sonar:
Pulsout init, 5
Output init
Rctime echo,1,wdist
Wdist = wdist/convfac
Pause 10
return
Original Message
From: Al Williams [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=rVYVhY2xyCkf5w13sZz8Bn9bjQOhzNUCbry30EyL6MHSPr14QREqmDypqySNxLsCF0Qx50tt27nVmxE1vw]alw@a...[/url
Sent: Sunday, May 04, 2003 12:06 PM
To: basicstamps@yahoogroups.com
Subject: RE: [noparse][[/noparse]basicstamps] Displaying variables on a parallel LCD
Hi Mike,
What's in the init code? What's in LCDWR (sounds familiar)?
Is char an ASCII character or a digit? Either way I'd think you'd see
something. A few LCDs require a negative contrast voltage. Are you sure
the LCD you have is Hitachi-compatible?
Need more info to help on this one.
Al Williams
AWC
*NEW KITS: http://www.al-williams.com/kits.htm
>
Original Message
> From: Mike Dillon [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=i5pRSrEm9QV7xLQgva65ISRA_AjiIMO2yqfNm3kIGVoEzSwEi2Rr54K1ZQ3ZwK14i3DxYsIkIkIJOpcOzwk]laxboy687@e...[/url
> Sent: Saturday, May 03, 2003 6:08 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Displaying variables on a parallel LCD
>
>
> Hi all,
> I'm trying to display the distance variable returned from my
> SRF04 sonar module on to a parallel lcd with a BS2. When I
> try all I get is 3 black boxes and I tried the contrast but
> that wasn't it. Heres my code:
>
> Wdist var word
>
> Main:
> Gosub SR_Sonar
> For index = 0 to 2
> Read wdist + index,char
> Gosub LCDWR
> next
> Pause 500
> Goto main
>
>
> Don't worry I have my initialization code and the sub
> commands for the sonar and LCD. I have been working on this
> for months to no avail. Thanks in advance.
>
> -Mike
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/