Thursday, January 19, 2012

Custom Character Demo with Serial Sender

Serial Sender, our free Windows tool for sending text and data via a comm port or USB adapter, has been updated to v1.2. Previous versions allowed you to send arbitrary bytes by wrapping their decimal values in angle brackets, like so: <65>. The update allows bytes expressed as hex: <0x41>. Some values, particularly bit patterns, are easier to work with in hex. Coincidentally, a user asked for guidance on defining custom characters for the GLO-216 with Serial Sender, so here it is:

Our serial OLED displays, GLO-216 and GLO-416 superficially resemble serial LCD modules. They fit the same mounting holes, have similar screen sizes, etc. But they are entirely different (superior!) displays, with better brightness, contrast and efficiency, support for multiple, large font sizes and a convenient serial interface.

One minor area of improvement is custom-character support. LCDs have eight, non-reusable custom characters—GLOs have 16 reusable custom characters. By "reusable" I mean that the same character can be printed and redefined on the same screen. GLOs allow this, but LCDs do not. When you redefine an LCD custom character, previously printed instances of that character change to the new pattern, garbling your screen.

GLO-216/416 Custom Characters. Custom characters occupy character codes 128 - 143 in the GLO character set. Defaults look like this:

Suppose we want to change character 128, the large degree ° symbol, to a padlock icon to indicate limited access or write-protection. First stop would be the Seetron site to use the online bitmap designer. Clickety-click, and the icon is designed:

Highlight the bitmap data in either format (decimal or hex) and copy it to the clipboard. Then open Serial Sender and type in the redefine-character instruction as described in the programmer's reference. Paste the bitmap data into the instruction. Result:

Click Send to download the pattern to the display. Repeat the process, making an open padlock in the bitmap designer, pasting the data into Serial Sender, and changing the ESC instruction from D0 to d0 (lowercase 'd'). This targets custom character 8, which lives at code 136.

Now the fun part, testing the new characters. Clear the text box, type and Send:

<L,128> Locked<M,136> Unlocked.

So far, all of this is very similar to stuff you can do with an LCD. Let's try something specific to the GLO-216— using the font-size capabilities. Type and send:

<L,C,B,128> Locked<C,P,74>unlock<P,89,126>exit

How about a big icon? Type and send:

<L,C,B,B,B,128,C> Access Denied<P,83>Abort/Retry?

If your custom characters are useful, you may want to save them to the GLO's flash memory. Easy: type and send <ESC>x0 (that's a lowercase 'x' and the number zero).

I've gone pretty fast here, presenting the Serial Sender sequences without much explanation. Basically it boils down to this: Instructions are listed in our documentation by control code, decimal code and hex code. You can use any of these sandwiched between < > brackets in Serial Sender, much as you can define constants in various ways in a programming language. Using Serial Sender to understand and debug sequences of instructions can be a real time saver. And of course if you still have questions, email tech at seetron dot com.

No comments:

Post a Comment