DDE Topic Reference

Implementation Details

The DDE service name for CPS Plus is: CPSPLUS.

 

DDE Topic Reference

 
+ DRIVER
+ COM1
+ COM2
+ COM3
+ … Dynamically created list of topics based on COM ports available on the system.
 
 
 
Topic: DRIVER
 
CPS Plus is: Server
Transaction Type: XTYP_REQUEST
Item: LIST
Format: String
Data: A tab-delimited string of all the topics supported by this server
 
Example: for MS Office VBA /
 
chan = DDEInitiate("CPSPLUS", "DRIVER")
F1 = DDERequest(chan, "LIST")
MsgBox CStr(F1)
DDETerminate chan
 
 
Default Item: LIST return tab-delimited string of all the topics supported by this server.
 
In CPS Plus version3.5, topic items that support hot linking are dynamically created based on RS232 COM ports available on the system: COM1, COM2, COM3… COMn 
 
Example: ' establish a HOT DDE link from Excel to COM1 (RS232 port 1)
Sheets("Sheet1").Cells(2, 2).Formula = "=CPSPLUS|DRIVER!COM1"
 
A request by a DDE client to CPS Plus to be notified immediately when data is read from specific COM port, and to include with that notification the value received from the RS232 port is named HOT DDE Link.
 
When the data is received from computer’s RS232 Com port, the CPS Plus generates an event notification back to the client and sends the data along with that event notice.
Example syntax:
 
=CPSPLUS|DRIVER!COM1     ' establish hot dde link to COM1
=CPSPLUS|DRIVER!COM2     ' establish hot dde link to COM2
……
………
=CPSPLUS|DRIVER!COM27     ' establish hot dde link to COM27
=CPSPLUS|DRIVER!COM50    ' establish hot dde link to COM50 …



Topic: COM1, COM2, … COMn
 
CPS Plus is: Server
Transaction Type: XTYP_REQUEST
Format: String
 
Topic Items for COM1 topic:
Item
Description
COM1COUNTER
Session counter. Starts from 0 when CPS Plus is started
COM1DATA
Filtered data received from COM port 1.
COM1DATARAW
Non-Filtered data received from COM port 1.
 
Dynamically created Topic Items for all available COM ports:
Item
Description
COMnCOUNTER
Session counter. Starts from 0 when CPS Plus is started
COMnDATA
Filtered data received from COM port n.
COMnDATARAW
Non-Filtered data received from COM port n.
n = number of COM port available on the system.
 
 
Examples: MS Office VBA
 
Sub GetCOM1Data()
' Example: Read data from serial RS232 port 1 - COM1.
On Error Resume Next
Dim F1 As Variant
chan = DDEInitiate("CPSPLUS", "COM1")
F1 = DDERequest(chan, "COM1DATA") ' get RS232 data from serial port COM1 into Excel temp variable F1.
MsgBox CStr(F1)
DDETerminate chan
End Sub
 
 
Sub GetCOM4Data()
' Example: Read data from serial RS232 port 1 - COM4.
On Error Resume Next
Dim F1 As Variant
chan = DDEInitiate("CPSPLUS", "COM4")
F1 = DDERequest(chan, "COM4DATA") ' get filtered RS232 data from serial port COM4 into Excel temp variable F1.
MsgBox CStr(F1)
DDETerminate chan
End Sub
 
 



CPS Plus is: Server
Transaction Type: XTYP_EXECUTE
Format: String
Dynamically created Topic Items for all available COM ports:
Item
Description
OPEN
Open connection to COM port
CLOSE
Close connection to COM port
RELOAD
Clear RS232 port buffer and reload port settings
FLUSH or
 RESETPORT
Clear RS232 port buffer (FIFO)
SETBREAK
Suspends character transmission
CLRBREAK
Restores character transmission
SETXON
Causes transmission to act as if an XON character has been received
SETXOFF
Causes transmission to act as if an XOFF character has been received.
SETRTS
Sends the RTS (request-to-send) signal.
SETDTR
Sends the DTR (data-terminal-ready) signal.
CLRRTS
Clears the RTS (request-to-send) signal.
CLRDTR
Clears the DTR (data-terminal-ready) signal.
WRITE
Write data to COM port
WRITE_HEX
Write data to COM port (data is specified as series of hex strings)
 
Topic Item: [CLOSE] – Close connection to COM port
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM1")
DDEExecute chan, "[CLOSE]"     ' close existing connection to COM port 1 (COM1)
DDETerminate chan
 
 
Topic Item: [OPEN] – Open connection to COM port
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM2")
DDEExecute chan, "[OPEN]"     ' close existing connection to COM port 2 (COM2)
DDETerminate chan
 
 
Topic Item: [RELOAD] – Clear RS232 port buffer and reload port settings.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM5")
DDEExecute chan, "[RELOAD]"     ' reload connection to COM port 5 (COM5)
DDETerminate chan
 
 
Topic Item: [FLUSH] or [RESETPORT] - Clear RS232 port buffer (FIFO)
Note: may not be compatible with some USB to RS232 converters.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM5")
DDEExecute chan, "[RESETPORT]"     ' Clear FIFO buffer for COM port 5 (COM5)
DDETerminate chan
 
 
Topic Item: [SETBREAK] - Suspends character transmission and places the transmission line in a break state.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM6")
DDEExecute chan, "[SETBREAK]"     ' COM6 - place the transmission line in a break state
DDETerminate chan
 
 
Topic Item: [CLRBREAK] - Restores character transmission and places the transmission line in a nonbreak state.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM6")
DDEExecute chan, "[CLRBREAK]"     ' COM6 - place the transmission line in a nonbreak state.
DDETerminate chan
 
 
Topic Item: [SETXON] - Causes transmission to act as if an XON character has been received.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM8")
DDEExecute chan, "[SETXON]"     ' COM8 - Set XON for serial port 8
DDETerminate chan
 
 
Topic Item: [SETXOFF] - Causes transmission to act as if an XOFF character has been received.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM8")
DDEExecute chan, "[SETXOFF]"     ' COM8 - Set XOFF for serial port 8
DDETerminate chan
 
 
Topic Item: [SETRTS] - Sends the RTS (request-to-send) signal.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM12")
DDEExecute chan, "[SETRTS]"     ' COM12 - Set RTS for serial port 12
DDETerminate chan
 
 
Topic Item: [SETDTR] - Sends the DTR (data-terminal-ready) signal.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM12")
DDEExecute chan, "[SETDTR]"     ' COM12 - Set DTR for serial port 12
DDETerminate chan
 
 
Topic Item: [CLRRTS] - Clears the RTS (request-to-send) signal.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM1")
DDEExecute chan, "[CLRRTS]"     ' COM1 - Clear RTS for serial port 1
DDETerminate chan
 
 
Topic Item: [CLRDTR] - Clears the DTR (data-terminal-ready) signal.
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM1")
DDEExecute chan, "[CLRDTR]"     ' COM1 – Clear DTR for serial port 1
DDETerminate chan
 
 
Note: If Handshaking/Flow control is enabled in COM port settings, it is an error for the application to adjust the line by using [CLRDTR/CLRRTS/SETDTR/SETRTS/ SETXON/ SETXOFF].
 
 



Topic Item: [WRITE(string string out)] – Write data to COM port.
Control codes must be supplied as ASCII values enclosed inside curly brackets.
Text and ASCII codes may be entered in any combination.
 
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM2")
DDEExecute chan, "WRITE(TARE{13}{10})"     ' COM2 – Write some data to serial port 2.
' {13}{10} are ASCII codes of Carriage Return and Line Feed.
' Send any ASCII code {ASCII NUMBER} by entering character value enclosed by curly brackets.
DDETerminate chan
 
 
 
 
Topic Item: [WRITE_HEX (string string out)]  - Write data to COM port by specifying data as series of hex digits. Useful when sending data that can’t be entered via keyboard.
 
Example: MS Office VBA - RS232/Serial port link
chan = DDEInitiate("CPSPLUS", "COM3")
DDEExecute chan, "WRITE_HEX(0x1B, INIT, 0xD, 0xA)"     ' COM3 – Write some data to serial port 3.
' 0x1B=hex character (27), INIT – plain string, 0xD=hex character (13),   0xA=hex character (10) 
DDETerminate chan