View Full Version : Displaying Variables
eman53132
11-09-2006, 10:53 PM
I am a student at UW-Platteville doing a project for my integrated circuits class.· I am using a Basic Stamp 2, DS1620 Temperature chip, and Hitachi LCD display.· I need to·display the variable temperature·on the LCD panel.· In Basic Stamp what·is the command to display·the temperature data from the chip to the LCD.··All of our components are working properly on their own.
·
Special_K
11-09-2006, 11:38 PM
think you will have to use a serout define a pin and then the variable.. look in the command ref.
Chris Savage
11-10-2006, 12:14 AM
Hello,
·
·· Is this a Serial or Parallel LCD Display?· That will greatly depend on how you go about displaying information on the display, since a serial display will be able to use formatters, whereas the parallel display will not.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
eman53132
11-10-2006, 06:14 AM
LCD display's we are using are parallel displays, with the 4 data lines, transmitting 4 bits per clock cycle
Chris Savage
11-10-2006, 06:31 AM
Okay,
·
·· With a Parallel Display it is not a problem, but you cannot use SEROUT and therefore you do not have access to these formatters.· It would help to know exactly what you’re trying to display, but have you tried using the code on our Parallel LCD Page?· It will certainly get you started accessing and using the display with a BASIC Stamp.
http://www.parallax.com/detail.asp?product_id=603-00006
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
charlieknox
11-10-2006, 09:30 AM
Chris - on a similar topic, I can use a DEBUG window to display the text Hello World by putting it in quotes, or I can display the decimal number 473 in the DEBUG window with DEBUG DEC 473.· If the number I want to display in the DEBUG window is variable, I can use DEBUG DEC x, to show the current value of x, assuming I have included x VAR Word above in the program.
With an LCD panel, to display text I·send "Hello World" to the LCD panel, character by character, and display it on the panel.· Or "473" can be displayed the same way (as characters in quotes).· But how do I display the current numerical value of a variable on an LCD panel?· The topic of displaying variable numerical values as they change on an LCD panel doesn't seem to be addressed in the examples provided.· Any light (or links to info) that you can shed on the topic would be much appreciated.
Thanks!
Charlie
Chris Savage
11-10-2006, 11:51 AM
Charlie,
·
·· Better examples are contained in our Stamp Works manual (page 73 on through page 92), at the following link.· The source code is at the second link.· I hope this helps.
http://www.parallax.com/dl/docs/books/sw/Web-sw-v2.0.pdf
http://www.parallax.com/dl/src/prod/StampWorks-2.0-Files.ZIP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
charlieknox
11-14-2006, 09:41 AM
In the program below, I am displaying the value of the constant y (7) on the LCD.· I would also like to display the current decimal value of x, the loop counter variable, on the LCD.· What must I add to the program to show the current decimal value of x on the LCD?· Thanks for your help.··I will·http://forums.parallax.com/images/smilies/jumpin.gif·when I find out how to do this!!···· Charlie
' {$STAMP BS2}
E· CON· 0· 'LCD Enable pin (1 = enabled)
RS· CON· 3· 'Register Select (1 = char)
LCDbus· VAR· OUTB· '4-bit LCD data bus
ClrLCD· CON· $01
CrsrHm· CON· $02
CrsrLf··· CON· $10
CrsrRt··· CON· $14
DispLf··· CON· $18
DispRt· CON· $1C
DDRam· CON· $80
y······ CON·· $37······· 'Display 7 for y value
char· VAR· Byte
index· VAR· Byte
x···· VAR·· Word········ 'Loop counter
Msg· DATA· "y is ", y ,"; x is ", x , 0···· 'Here I would like to show the current value of x - How??
Initialize:
DIRL = %11111101
LCD_Init:
PAUSE 500
LCDbus = %0011
PULSOUT E, 1
PAUSE 5
PULSOUT E, 1
PULSOUT E, 1
LCDbus = %0010
PULSOUT E, 1
char = %00001100
GOSUB LCD_Command
char = %00000110
GOSUB LCD_Command
Main:
PAUSE 1000
x = x + 1······················ 'Loop counter variable
char = ClrLCD
GOSUB LCD_Command
PAUSE 500
index = Msg
IF x = 5 THEN QUIT······· 'End when x = 5
READ_Char:
READ index, char
IF (char = 0) THEN Main
GOSUB LCD_Write
index = index + 1
GOTO READ_Char
QUIT:
END
LCD_Command:
LOW RS
LCD_Write:
LCDbus = char.HIGHNIB
PULSOUT E, 1
LCDbus = char.LOWNIB
PULSOUT E, 1
HIGH RS
RETURN
charlieknox
11-14-2006, 10:00 AM
As a follow up to my question above, what must be done differently (if anything) if the varying number being displayed on the LCD has 2 or 3 digits, instead of just 1? Thanks again,
Charlie
Chris Savage
11-15-2006, 11:35 PM
A quick search of the forums shows the following example links where this has come up before.· Perhaps one of these will give you what you need.· Take care.
http://forums.parallax.com/showthread.php?p=609237
http://forums.parallax.com/showthread.php?p=568768
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
here is a snippet of code from a larger BS2 program of mine. This should give you an idea on how to do it. Just pay attention to the code in main, the rest are the LCD write routines which I'm sure you'r not interested in since they were taken from other parallax references.
Mike
eman53132
11-17-2006, 12:12 AM
thankyou all for the help. I am able to do what i wanted.