Data Sheet

dScript
dScript User Manual v2.15
string s1[100]
serialport LCD05 1 10 90
s1 = "Hello World"
LCD05.Write(s1,0,11)
Here we are sending 11 bytes from string s1 beginning at the first location (string indexes are
zero based) to serial port 1 which we have named as LCD05.
A better way is to place the byte count into the the write command is to used the string length
parameter.
LCD05.Write(s1,0, s1.Length)
The length of a string is the number of bytes up to and excluding an 0x00 value. This 0x00 is
automatically placed at the end when you assign text to a string.
S1 = “Hello”
will require 6 bytes, placing the 5 characters of the text in positions 0-4 of the string. Position
5 will be 0x00.
S1.Length will return 5.
Sometimes you will want to include some non ASCII commands. In the case of the LCD05 you
might want to send initialisation or cursor control commands. Here's our “hello world” example
again, this time we have put three spaces in front of the text.
string s1[100]
serialport LCD05 1 10 90
s1 = " Hello World" ; three spaces before the text
s1[0] = 12 ; LCD05 command to clear screen & home the cursor
s1[1] = 19 ; LCD05 command to turn backlight on
s1[2] = 4 ; LCD05 command to hide the cursor
LCD05.Write(s1,0,s1.Length)
After loading the “Hello World” text into s1, we then replace the three spaces with our LCD05
commands. The LCD05 will clear the screen and set the cursor position to the top left. It will
turn the backlight on and then hide the cursor. The “Hello World” text will then be printed
starting at the cursor position (top left of the display).
Copyright © 2016, Devantech Ltd.
All rights reserved.
www.robot-electronics.co.uk
30