|ByVac IASI-2 Commands for HD47780 LCD Displays|
Many of my projects use 20x4 or 20x2 LCD displays with a ByVac IASI-2 serial interface. Although this particular serial interface is no longer available, this page is a useful reference for converting my program code to use a more conventional serial LCD display or even a parallel display. Knowing what the code in my programs does should make it easier to convert it.
Depending on whether you're converting code for the Arduino or the Picaxe determines the actual code. Typically Picaxe code will be something like serout B.7,N2400,(...) and Arduino code will be something like lcd.print(...);
All we're interested in here is what's inside the parenthesis.
The ByVac IASI-2 interface accepts three kinds of strings as ASCII characters - backlight control commands, cursor control commands and text/numerical values.
All strings begin with the serial interface address which, in my programs, is always represented by the ASCII letter "a". The second character in the string depends on what kind of data is being sent to the display:
Backlight control commands use the ASCII character "b". So, to turn the backlight off, you would send the string "ab0" and to turn it on, "ab1".
Cursor control commands use the ACSII character "c". So, for example, the string "ac1" clears the display and sets the cursor at the top left. Most commands are associated with positioning the cursor in readiness for printing text or numerical values on the LCD. The tables below show all the most-used commands. So, for example, the string "acd4" would position the cursor at the beginning of the bottom row on the LCD.
Text and numerical values begin with "ad" so the string "adHello World" would send 'Hello World' to the LCD.
It's important to note that the string must be followed by the 'Return' character. For the Arduino, this will be "\r" and, for the Picaxe, the numerical value 13.
The Arduino doesn't seem to allow text and numerical values to be mixed in the same statement so it's common to see 'compound' lines broken down. For example:
Arduino: lcd.print("adVoltage: "); lcd.print(measured_volts); lcd.print(" volts\r");Hopefully, the above information and the following tables will be enough to allow you to convert the LCD code I've used in my programs to code you need to use for your LCD display.
Cursor positioning commands - "ac--" (Hex).
CGRAM Character Locations
The following Picaxe subroutine (SendCmdByte) sends the hex commands to the Picaxe hardware serial out in the format required by the ByVac IASI2 Serial Controller. It's useful when a cursor-positioning command is calculated on the fly and saved as a
byte so a "hard-coded" command
SYMBOL abyte = b0 SYMBOL nibble = b1 hsersetup B9600_4, %10000 ;Minimum rate is 9600 hserout 0, (13) : pause 100 ;so use hserout not serout. hserout 0, (13) : pause 100 ;Get auto-baud rate (2 x cr) hserout 0, ("ac1", 13) : pause 500 ;and initialize LCD SendCmdByte: ;The following is adapted from 'hippy' at http://www.picaxeforum.co.uk/ ;It converts the single character address byte into two ASCII hex text characters ;as required by the ByVac Controller. nibble = abyte / $10 + "0" if nibble > "9" then : nibble = nibble + 7 : endif hserout 0, ("ac", nibble) ;Send high nibble. No 'cr' yet as we still need to ;convert and send the low nibble. nibble = abyte & $0F + "0" if nibble > "9" then : nibble = nibble + 7 : endif hserout 0, (nibble, 13) return