Our resident expert on all things
robotic is merely an Email away.
Tap into the sum of all human knowledge and get your questions answered here!
From software algorithms to material selection, Mr. Roboto strives to meet you
where you are — and what more would you expect from a complex service droid?
Q. This might sound like a stupid question, but how
do you display numbers on a serial LCD? I have a
serial LCD from Parallax that was given to me at
this year’s FLL (FIRST LEGO League) tournament, and it
works great for printing characters, but when I send it a
number it prints what looks like a random number. Yeah, I
know, it’s an ASCII character. So, how do you convert a
byte size number into a three digit number to display on the
serial LCD? I don’t suppose that you would be willing to
explain how to convert that same byte into an eight digit
— Pat Smith
A. Like I always say, there is no such thing as a stupid
question. The only reason you are asking is because
you don’t know, and I am sure that there are a lot of
other people that have the same question in the back of their
minds. It is great to hear that you are participating in the
FIRST LEGO League ( www.firstlegoleague.org). I think
everyone reading this magazine should get involved with the
different FIRST activities. The Parallax serial LCD (www.
Figure 1. BlueSMiRF serial modem from SparkFun Electronics.
14 SERVO 02.2008
parallax.com) is a really simple LCD module to get up and
running. Only one wire, plus power and ground is needed
to control it.
This isn’t that difficult, and many microcontrollers
will automatically do this for you, such as the BASIC
Stamps from Parallax. Basically, all you have to do is take
your number and divide it by 100. The integer part of
the result is the first digit to be displayed. Then take the
remainder of that division and divide it by 10, and the
integer part of that result is the second digit to be
displayed. And what is remaining, is the third digit to be
displayed. The LCD_DEC programming example shown
here is a short and simple BASIC Stamp 2 program that
will display a single byte value as a three digit number on
the serial LCD.
CON 32 ‘9600 baud on a BS2
temp1 = 195
temp2 = temp2 + 48
Serout TxPin, LCD_Baud, [temp2]
temp3=temp3 + 48
Serout TxPin, LCD_Baud, [temp3]
temp4=temp4 + 48
Serout TxPin, LCD_Baud, [temp4]
Temp1 is some number that I have randomly chosen
to be displayed on the LCD. If you are not familiar with
the // function, it is called the MODULUS function and it