Reading a Maxbotix EZ1 Sonar with the SX28 - outputting the result to a Serial
I do not understand how to send a variable to the LCD with the SX. I am storing a variable from an ultrasonic distance sensor. (MaxBotix - MaxSonar EZ1 http://www.maxbotix.com/MaxbotixHome.html) I am trying to convert that variable into ASCII characters so I can use the serout command to display that value onto my LCD screen (Parallax Item code 27979). I tried modifying a code from another thread "Sending a variable to a serial LCD" in the Best SX Threads Index, but I do not understand how it works. I pasted my code below for the ultrasonic sensor portion. I want to be able to take the variable time, and display that value to my LCD. I appreciate any help.
DEVICE SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ 4_000_000
pwpin PIN RB.0
store var word
counter var word
time var word
Program Start
Start:
for counter = 1 to 10
Pulsin pwpin, 1, store
pause 50
time = store*10
next
' watch time
' break
Pause 5000
goto start
DEVICE SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ 4_000_000
pwpin PIN RB.0
store var word
counter var word
time var word
Program Start
Start:
for counter = 1 to 10
Pulsin pwpin, 1, store
pause 50
time = store*10
next
' watch time
' break
Pause 5000
goto start
Comments
· This is the basic method for converting a value to ASCII.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?
www.iElectronicDesigns.com
Post Edited (Bean (Hitt Consulting)) : 5/5/2008 11:11:20 AM GMT