how display on LCD using ADC0831
I was wondering if anyone have interfaced ADC0831 with LCD screen (2 x 16 backlight)
i succefully displayed the voltage sampled on debug screen but i am not being able to code to display on LCD
if anyone have any sample code please let me know
thx
i succefully displayed the voltage sampled on debug screen but i am not being able to code to display on LCD
if anyone have any sample code please let me know
thx
Comments
You'll have to say more about what you have and what you want to do specifically.
here is the description
i am reading voltage (0-5v) out of a current sensor and feeding it to BS2 through ADC 0831. now i have to display that voltage on a LCD (2x16 serial LCD from parallax)
i am totally new to basic stamp programming so dont really know how to start.
here is the code i used to display the voltage in debug command.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] Declarations ]
adcBits VAR Byte
v VAR Byte
r VAR Byte
v2 VAR Byte
v3 VAR Byte
'
[noparse][[/noparse] Initialization ]
CS PIN 0
CLK PIN 1
DataOutput PIN 2
DEBUG CLS 'Start display.
'
[noparse][[/noparse] Main Routine ]
DO
GOSUB ADC_Data
GOSUB Calc_Volts
GOSUB Display
LOOP
'
[noparse][[/noparse] Subroutines ]
ADC_Data:
HIGH CS
LOW CS
LOW CLK
PULSOUT CLK, 210
SHIFTIN DataOutput,CLK,MSBPOST,[noparse][[/noparse]adcBits\8]
RETURN
Calc_Volts:
v = 5 * adcBits / 255
r = 5 * adcBits // 255
v2 = 100 * R / 255
v3 = 100 * r // 255
v3 = 10 * v3 / 255
IF (v3 >= 5) THEN v2 = v2 + 1
IF (v2 >= 100) THEN
v = v + 1
v2 = 0
ENDIF
RETURN
Display:
DEBUG HOME
DEBUG "8-bit binary value: ", BIN8 adcBits
DEBUG CR, CR, "DVM Reading: ", DEC3 v, " Volts"
DEBUG CR, CR, "DVM Reading: "
DEBUG DEC1 v, ".", DEC2 v2, " Volts"
RETURN
now if you can suggest me how can i display on LCD that would be of great help
thx
It is always best to first verify that you can make the added hardware work alone before you try to cut and paste software to fit your needs. In this case, you will just replace the Debug output with the appropriate interface to LCD. You may have to add another serial port, consider the right baud rate, and you may want to keep Debug working until you have both I/Os doing the same thing.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PLEASE CONSIDER the following:
Do you want a quickly operational black box solution or the knowledge included therein?······
Post Edited (Kramer) : 1/10/2008 9:13:33 AM GMT