How do I send variable data to my LCD Display?
Mooneyguy
Posts: 77
I purchased a 2x16 Serical LCD Backlit, with Speaker (#27977-RT) for by Basic Stamp 2. I can make the sample display programs work from the Parallax site but have not idea how to send my results to the display from my application program.
I have a code like the following and want to send the mVoltsOutput and Gallons result to the display. I would like the output results to continually display in one spot and not scroll, etc. so it so I can see continual changes in the output in one position on the display. mVoltsOutput on the top line and Gallons on the bottom line. Can some one please help me?
DEBUG "Output (mv): ", DEC mVoltsOutput, " Output (Gallons): ", DEC Gallons, CR
LOW CS
SHIFTOUT DataIn, Clock, MSBFIRST, [Offset]
SHIFTIN DataOut, Clock, MSBPOST, [ADCoutput\13]
HIGH CS
mVoltsOutput = ADCoutput */ Cnts2Mv ' Convert ADC Output To Millivolts
Gallons = mVoltsOutput/2
GOSUB GetADC
RETURN
Incidentally, when I plugged the Rx lead from the display into P0 of the Basic Stamp 2, my mVoltsOutput read zero for some reason when I would run the debug. I was able to measure the mv with my dvm with good results but only 0 would show on my debug screen so it had to do with something in the Stamp. When I pulled the Rx out from the display and unplugged the Basic Stamp 2 input power and replugged the power back in, I was able to get my mV to read on the debug screen.
Other possibly helpful information is:
Dout from the Parallax 604-00062 (MCP3208) Analog to Digital Converter goes to P4 of the stamp, CS/SHIN goes to P5, DIN to P3.
mVoltsOutput VAR Word ' ADCoutput converted to mVolts.
Cnts2Mv CON $0139 ' x 1.22 convert to Millivolts (=5000mv/4096 in Hex)
ADCoutput VAR Word ' Analog to Digital Conversion results.
I have a code like the following and want to send the mVoltsOutput and Gallons result to the display. I would like the output results to continually display in one spot and not scroll, etc. so it so I can see continual changes in the output in one position on the display. mVoltsOutput on the top line and Gallons on the bottom line. Can some one please help me?
DEBUG "Output (mv): ", DEC mVoltsOutput, " Output (Gallons): ", DEC Gallons, CR
LOW CS
SHIFTOUT DataIn, Clock, MSBFIRST, [Offset]
SHIFTIN DataOut, Clock, MSBPOST, [ADCoutput\13]
HIGH CS
mVoltsOutput = ADCoutput */ Cnts2Mv ' Convert ADC Output To Millivolts
Gallons = mVoltsOutput/2
GOSUB GetADC
RETURN
Incidentally, when I plugged the Rx lead from the display into P0 of the Basic Stamp 2, my mVoltsOutput read zero for some reason when I would run the debug. I was able to measure the mv with my dvm with good results but only 0 would show on my debug screen so it had to do with something in the Stamp. When I pulled the Rx out from the display and unplugged the Basic Stamp 2 input power and replugged the power back in, I was able to get my mV to read on the debug screen.
Other possibly helpful information is:
Dout from the Parallax 604-00062 (MCP3208) Analog to Digital Converter goes to P4 of the stamp, CS/SHIN goes to P5, DIN to P3.
mVoltsOutput VAR Word ' ADCoutput converted to mVolts.
Cnts2Mv CON $0139 ' x 1.22 convert to Millivolts (=5000mv/4096 in Hex)
ADCoutput VAR Word ' Analog to Digital Conversion results.
Comments
http://www.parallax.com/sites/default/files/downloads/27976-Serial-LCD-BS1-BS2-Code-RevF.zip
http://www.parallax.com/sites/default/files/downloads/27979-Parallax-Serial-LCDs-Product-Guide-v3.1.pdf
SEROUT TxPin, Baud, [stuff to display]
instead of
DEBUG stuff to display.
You can include set cursor commands with the other stuff. See Moving the Cursor on page 4 of the data sheet. See Command Set on page 7 of the data sheet.
"For extensive code examples .... see "Smart Sensors and Applications" ...."
GetADC: ' Gets pressure output in mv.
HIGH TxPin ' Set pin high to be a serial port
PAUSE 100 ' Pause for Serial LCD to initialize
DEBUG "Output (mv): ", DEC mVoltsOutput, " Output (Gallons): ", DEC Gallons, CR
LOW CS
SHIFTOUT DataIn, Clock, MSBFIRST, [Offset]
SHIFTIN DataOut, Clock, MSBPOST, [ADCoutput\13]
HIGH CS
mVoltsOutput = ADCoutput */ Cnts2Mv ' Convert ADC Output To Millivolts
Gallons = mVoltsOutput/2
SEROUT TxPin, Baud19200, mVoltsOutput ' Display output in mV on LCD
GOSUB GetADC
RETURN
The parameters you want to display have to be in brackets [ ] and preceded by a format specifier (i.e. DEC for DECimal)
GetADC: ' Gets pressure output in mv.
HIGH TxPin ' Set pin high to be a serial port
PAUSE 100 ' Pause for Serial LCD to initialize
SEROUT TxPin, Baud19200, [12]
SEROUT TxPin, Baud19200, [17] 'Turn display backlight on
LOW CS
SHIFTOUT DataIn, Clock, MSBFIRST, [Offset]
SHIFTIN DataOut, Clock, MSBPOST, [ADCoutput\13]
HIGH CS
mVoltsOutput = ADCoutput */ Cnts2Mv ' Convert ADC Output To Millivolts
Gallons = mVoltsOutput/2
DEBUG "Output (mv): ", DEC mVoltsOutput, " Output (Gallons): ", DEC Gallons, CR
SEROUT TxPin, Baud19200, [DEC mVoltsOutput, " mV"]
SEROUT TxPin, Baud19200, [13] 'Carriage Return – For the two line LCD model, if on line 0 the cursor
'is moved TO position 0 ON line 1. IF ON line 1, it wraps around TO
'position 0 ON line 0.
SEROUT TxPin, Baud19200, [DEC Gallons, " Gallons"]
PAUSE 1000
SEROUT TxPin, Baud19200, [12] 'Form Feed - The cursor is moved to position 0 on line 0 and the
'entire display is cleared. Must PAUSE 5mS after this command.
PAUSE 5
GOSUB GetADC
RETURN
Thanks!!!