
Custom Character BasicX Code Snippet:
' Load Down Arrow as char 0
Call PutQueueStr(Com3Out,Chr(18) & Chr(64) & Chr(4) & Chr(4) & Chr(4) & Chr(4) & Chr(4) & Chr(31) & Chr(14) & Chr(4))
‘ Print char 0 (new down arrow)
Call PutQueueStr(Com3Out,Chr(0))
Complete BasicX-24 Example Program
' This program turns on the LCD 2X16 backlight and displays a “Hello World” message.
' Connections:
' LCD Gnd to BasicX-24 Pin23
' LCD +5 to BasicX-24
' LCD LEDSV+ to BasicX-24 Pin24 or 5-12Vdc 150mA + supply
' LCD RX to BasicX-24 Pin 5
' Define Com3 buffer sizes
Dim Com3In(1 to 15) As Byte
Dim Com3Out(1 to 40) As Byte
' Define the LCD control constants we will use
Const BackLite As Byte = 20
Const Clear_LCD As Byte = 12
Const Set_Cursor As Byte = 17
'************************************************************
Sub Main()
' Wait 1/2 second after power up for LCD to stabilize
Call Sleep(256)
' Open Com3 Buffers
Call OpenQueue(Com3In, 15)
Call OpenQueue(Com3Out, 40)
' Set Com3 to Inverted Logic, 8 Data Bits, No Parity, Pin12 TX, 0 = NO RX pin
Call DefineCom3(0, 5, bx1000_1000)
' Open Com3
Call OpenCom(3, 9600, Com3In, Com3Out)
' Run greeting subroutine
Call Greeting
Do 'We are done. Sit here and do nothing
Loop
End Sub
'************************************************************
Sub Greeting()
' Set backlight to full brightness
Call PutQueueStr(Com3Out,Chr(BackLite) & Chr(255))
' Send Clear LCD command and first 1/2 of message "Hello World!"
Call PutQueueStr(Com3Out,Chr(Clear_LCD) & " Hello World!")
' Move cursor to Row 2 column 4
Call PutQueueStr(Com3Out,Chr(Set_cursor) & Chr(1) & Chr(3))
' Display the rest of the message "I'm Alive!"
Call PutQueueStr(Com3Out,"I'm Alive!")
End Sub ' Return
8