Products | Support | Sales | Company | ![]() |
Serial LCD DLL for 32-bit Windowsupdated: December 10, 1999 Thousands of users have successfully interfaced our serial displays to everything from BASIC Stamps to high-end workstations. For most, the hardest part is determining how to configure and use the serial port with their programming language. This app note presents an ultra-simple dynamic link library (DLL) for Windows (95/98/NT/2000) computers that should allow any programming language that can use DLLs to talk to our displays. Fine Print: This software is presented free to our customers for their own private, non-commercial use. Scott Edwards Electronics, Inc. accepts no liability for any consequences of its use, performance, or non-performance. Use this software at your own risk. While we encourage you to report any problems you encounter with this software, we cannot provide tech assistance with the DLL-calling mechanism for the various Windows programming languages. Some provide no, partial, or buggy DLL support. Installing the DLLA DLL is a library of software functions that can be loaded and used by a program running on your Windows computer. Much of what we think of as the "Windows operating system" is made up of many DLLs. The serial display DLL is a single, small (less than 30kB) file. To install it, just drop it into the folder "C:\Windows\System". Using the DLLJust five functions make up the serial display DLL:
Using the DLL just consists of calling The Visual BASIC Program ExampleIt's fair to say that Visual BASIC is a popular Windows language, so that's what we used to create a demo for the DLL. The details of declaring and calling DLLs from other languages are in their respective user manuals--we cannot provide tech support on this subject. If you've never called a DLL from your programming language before, read the manual thoroughly, and try the idea out with some other DLL. Here's a screenshot of the demo program: ![]() Here is the entire code-window listing of the example program, which was written in VB6: Private Declare Function SER_OPEN& Lib "SERSEN04.DLL" (ByVal commPort&, ByVal baudRate&) Private Declare Function SER_CLOSE& Lib "SERSEN04.DLL" () Private Declare Sub SER_SEND Lib "SERSEN04.DLL" (theString$) Private Declare Sub SER_RAWSEND Lib "SERSEN04.DLL" (theString$) Private Declare Function SER_VERSINFO$ Lib "SERSEN04.DLL" () Private Sub Command1_Click() ' Code for the "Send" button. Call SER_OPEN(2, 9600) SER_SEND (Text1.Text) Call SER_CLOSE End Sub Private Sub Command2_Click() ' Code for the "Version" button. Text1.Text = SER_VERSINFO$() End Sub Download and Run the VB ExampleClick here to download a small ZIP file containing the DLL and VB example programs. This is version 0.1, December 10, 1999.
SER_SEND and Special CharactersBefore the For example, in VB, to tack a carriage return onto the end of a string, you would write:
All of these examples would send the demo phrase followed by ASCII 13, the carriage-return character. The advantage of the
(Note that 65 is the ASCII code for A, 66 is B... and so on.) Since the documentation for our serial displays gives instructions in terms of their ASCII codes and/or control-characters, this feature should make your programming life easier. But wait, there's more!
We've broken out the various named instructions into several separate pages by category and/or type of display:
Sending Variables with SER_SENDThe <> tags that
For those unfamiliar with the SGX and BGX displays, adding 64 to a value allows it to be sent as a single-byte shortcut, rather than a numeric string. This saves transmission time. Final NotesThe DLL described here is not threaded, meaning that it halts your program's execution for the amount of time required to process and send a string. This time is depends on the baud rate and the length of the string (after processing any bracketed text, in the case of SER_SEND). Use the following approximate values to estimate time required:
Typical transmissions to serial displays are quite short, so the times required are very brief; you can rewrite every character of a 4x40 text LCD screen in under 2/10ths of a second. Just bear in mind that if your program makes unusually frequent updates of the display and/or uses a slow baud rate, there may be a noticeable slowdown in Windows' response. In this case, consider using a fancy, threaded/buffered serial communication control or library. See www.lvr.com for links to information on advanced serial-port programming. That said, 99% of applications will do just fine with our easy-to-use DLL. All trademarked names used in this document are the property of their respective holders.
|