SendP() - The Send Custom IP Packet Command
This command is used to send custom messages from a port; including IP ports.
You can send Hex, Decimal, or ASCII characters as raw data or from memory locations.
Everything you can do with this command can be done by the SendPF() command.
Device |
Status |
PDEG |
Confirmed |
PDEB |
Confirmed |
PDDEG-S |
Confirmed |
DDRC-GRMS-E |
Confirmed |
DDBC320-DALI |
Not Tested |
PDTS |
Confirmed |
DDNG485 V3 |
Confirmed |
PDZG |
Not Tested |
Configuration
EthernetGateway can be the server or the client.
Port type needs to be set to Text.
In Client mode you need the IP address of the 3rd party device and port number to set up the connection.
In Server mode you define the IP address and port number to set up the connection and provide this to the 3rd party installer.
Syntax
SendP(Port Type, Port Index, Data, …)
Can send multiple commands in one string.
Limited to 126 characters.
If you specify a memory location it will send all consecutive memory locations until it reaches a null value. (0x00)
-
1 - RS485 Port
-
2 - IPv4 Port
-
3 - IPv6 Port
-
5 - WebSocket
Advanced Use - Offsetting with the X Register
The X register can be used to create an offset when recalling data from memory locations.
To do this specify a starting memory location followed by "x" and how many values to send.
SendP(Port Type, Port Index, Memory Location,x,Length)
Here is a chart to help convert ASCII characters to hex so you can store them in memory locations. |
Examples
Example 1
In this first example we send a simple 5 character message to IPv4, Index 2
Task2()
{
Name="Text over IP"
SendP(2,1,"ABCDE") // sends the text string ABCDE
}
Example 2
In this example we build a string using tilde locations and then send it out. The Null value tells it where the end of the string is.
Task2()
{
Name="Advanced Text over IP"
LDA #0x41 //'A'
STA ~0
LDA #0x42 //'B'
STA ~1
LDA #0x43 //'C'
STA ~2
LDA #0x44 //'D'
STA ~3
LDA #0x45 //'E'
STA ~4
LDA #0x00 //Null
STA ~5
SendP(2,1,~0) // sends the text string ABCDE
}
Example 3
In this example we build using Tilde locations, set an offset of 1, and a length of 2.
Task2()
{
Name="Advanced Text over IP"
LDA #0x41 //'A'
STA ~0
LDA #0x42 //'B'
STA ~1
LDA #0x43 //'C'
STA ~2
LDA #0x44 //'D'
STA ~3
LDA #0x45 //'E'
STA ~4
LDA #0x00 //Null
STA ~5
LDX #0x01 // Set an offset of 1
SendP(2,1,~0,x,2) // sends the text string BC
}