Discontinued Product
 
Click to see
all of our products!

Wieser Software Ltd

Serial Port Control by DDE

Version 1.03 now available
Use it with FileMaker, Word, Excel or any other program supporting DDE in a Macro!

 

Frequently Asked Questions about Sending Commands to RS232 Serial Devices

Many software packages now support macro languages to control other programs. Details of how to send data using various packages are listed below

Send Serial RS232 Data using Microsoft Word

To build a simple macro with Word, record a macro, and include the following code:


Sub SendRS232usingDDE()
'
' SendRS232usingDDE Macro
' Macro created 22/06/2006 by Wieser Software Ltd
'
iChannel = DDEInitiate("matrxdde", "system")
DDEExecute iChannel, "Send this to\r\nthe Serial Port"
DDETerminate iChannel

End Sub

Back to Top

Send Serial RS232 Data using Microsoft Excel

The procedure using Excel is identical to using word. Below is an example of sending the data that is in the current cell.

Sub SendCurrentCell()
'
' SendCurrentCell Macro
' Macro recorded 22/06/2006 by Wieser Software Ltd
'
    iChannel = DDEInitiate("matrxdde", "system")
    DDEExecute iChannel, ActiveCell.Value
    DDETerminate iChannel
End Sub

Alternatively, you could replace the DDEExecute command with:


    DDEExecute iChannel, Range("a1").Value

That would send the value of whatever is in cell A1 to the serial port.

Back to Top

Send Serial RS232 Data using FileMaker Pro

Using Filemaker Pro, when you define a script, you use the Send DDE Execute script item. You would use settings as follows, selecting the Text pushbutton shown by filemaker instead of the file button:


Send DDE Execute [Service Name: "matrxdde"; Topic: "system"; Commands: "put this on the display"]

Obviously, it will be more useful, if you combine fields that are actually in your database

Back to Top

Sending special characters to Matrix Orbital MOS Displays and other displays

Some devices, like the Matrix Orbital MOS AL202 LCD display use special commands to configure the display. Many of the commands are in binary format, and therefore need special handling. Because many software packages cannot handle numbers in binary format, we allow you to insert them in a quoted format which doesn't require any special handling from the program running the macros.

For instance, the Matrix Orbital Documentation says:


4.3.13 Clear Display
Syntax: Hexadecimal 0xFE 0x58
Description: This command clears the display and resets the text insertion point to the
top left of the screen.

To include these characters in your text, simply add them to the beginning of your text as follows:

DDEExecute iChannel, "\xFE\x58Show this after \nclearing the display"

You'll notice two things about the code. First, it can escape hexadecimal sequences by using \x followed by two hexadecimal digits. If you need to convert a decimal number to hexadecimal, do the following:

  1. Start the Windows calculator
  2. Press F6 to switch to decimal
  3. Type your number in decimal
  4. Finally, press F5 to convert the number to hexadecimal.

Secondly, you'll notice the \n character; shorthand for a new line character (\x0A).  You can also use the following:

As a result, it is now difficult to include a \ character.  To do so, simply use two in a row, like this: \\

Back to Top

Command Line Arguments to configure the Serial Port

If you configure your program to start with a shortcut, you can add additional arguments to the command line to control which serial port is opened, and what baud rate is used for communication. The switches are:

  • /baud:NNNN where NNNN is a baud rate, like 19200, 115200, etc.
  • /port:com1 where com1 can be replaced with any serial port name on your system.
  • The software always uses 8 bits for the data width, and 1 stop bit, with no handshaking.

    Back to Top


    "Windows is a registered trademark of Microsoft Corporation in the United States and other countries."
    Read our privacy policy
    Copyright © 1998-2014 by Wieser Software Ltd
    All Rights Reserved