StampWorks Experiment Questions
Ivan2
Posts: 1
I’ve been working through the experiments in the Stamp Works kit. The latest exercises I’ve been working on are:
Experiment #11: Basic LCD Demonstration
Experiment #12: Creating Custom LCD Characters
·
I’ve been trying to understand the code as I go through each experiment. In these two experiments I’ve run into something I don’t understand at all. In sending commands to the LCD the part of the code that I’m confused about shows as follows:
·
From file: File....... SW21-EX11-LCD_Demo.BS2
“.
.
·
char··········· VAR···· Byte··················· ' character sent to LCD
.
.
.
· char = %00001100····························· ' on, no crsr, no blink
· GOSUB LCD_Cmd
· char = %00000110····························· ' inc crsr, no disp shift
· GOSUB LCD_Cmd.
.
.
'
[noparse][[/noparse] Subroutines ]
·
LCD_Cmd:
· LOW RS···
.
.
“
In the Basic Stamp Manual the statement to send commands to the LCD should appear as:
.
.
.
LCDCMD Lcd, %00001100 ' display on without cursor
LCDCMD Lcd, %00000110 ' auto-increment cursor
.
.
·
I can’t figure out how in the original program (Stamp Works kit) “char” ever reaches the LCD?
The way the book explains it makes more sense. The way the program executes makes no sense at all. That is to say, “char” is defined as a variable Byte, it is loaded with a binary sequence then the next thing that happens is the RS pin of the LCD is set to low then that’s it. I see no association between “char” and the way it is sent to the LCD. How is this possible ?
Post Edited By Moderator (Joshua Donelson (Parallax)) : 6/7/2010 9:56:57 PM GMT
Experiment #11: Basic LCD Demonstration
Experiment #12: Creating Custom LCD Characters
·
I’ve been trying to understand the code as I go through each experiment. In these two experiments I’ve run into something I don’t understand at all. In sending commands to the LCD the part of the code that I’m confused about shows as follows:
·
From file: File....... SW21-EX11-LCD_Demo.BS2
“.
.
·
char··········· VAR···· Byte··················· ' character sent to LCD
.
.
.
· char = %00001100····························· ' on, no crsr, no blink
· GOSUB LCD_Cmd
· char = %00000110····························· ' inc crsr, no disp shift
· GOSUB LCD_Cmd.
.
.
'
[noparse][[/noparse] Subroutines ]
·
LCD_Cmd:
· LOW RS···
.
.
“
In the Basic Stamp Manual the statement to send commands to the LCD should appear as:
.
.
.
LCDCMD Lcd, %00001100 ' display on without cursor
LCDCMD Lcd, %00000110 ' auto-increment cursor
.
.
·
I can’t figure out how in the original program (Stamp Works kit) “char” ever reaches the LCD?
The way the book explains it makes more sense. The way the program executes makes no sense at all. That is to say, “char” is defined as a variable Byte, it is loaded with a binary sequence then the next thing that happens is the RS pin of the LCD is set to low then that’s it. I see no association between “char” and the way it is sent to the LCD. How is this possible ?
Post Edited By Moderator (Joshua Donelson (Parallax)) : 6/7/2010 9:56:57 PM GMT
Comments
GOSUB goes to the subroutine that sends the data to the LCD then returns to the next line in the code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
·· Here is a picture that is used in What's A Microcontroller? Text that helps explain how Sub Routines work. If you would like, you can download the text for a further explanation; but this image can give you a visual of how the program operates.
What's A Microcontroller [noparse][[/noparse] .pdf ]:
http://www.parallax.com/Portals/0/Downloads/docs/prod/edu/28123-WAM-v3.0.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com