TX - The Transmit (TX) Command

This command sends a DyNet packet to a specified communication port. This can be used to send any DyNet packet including logical, physical, DyNet2, and 0x6C messages.

Only a valid DyNet message can be sent using the TX function.

It has three parameters: Source, Port, Length.
The source is the start location of the message to transmit. This can be a tilde memory (~), a persistent memory ($), or a label.
The port is the communication port you wish to send the message to. You can send it to port 1, port 2, both, or DyNet mute the message to port 0 so only the device sending the message hears it.
The length indicates how many bytes are to be sent.

TX’ing to port 0 (DyNet Mute) is a powerful way to way to reduce network traffic when doing things like updating icons, button states, or pages on a display or touchscreen.

Syntax

TX source,port,length
Source is the label or starting memory location for the message.
Port is the communication port to send the message to.
Length is how many bytes the packets is minus the checksum. This value is automatically calculated by the compiler and added to the output.

Comm Ports
  • 0 - DyNet Mute, Only "heard" internally by the local device

  • 2 - Port 1 (Spur)

  • 5 - Port 2 (Trunk)

  • 8 - Both Ports 1 and 2

The TX command is not precise enough to differentiate between different IP ports and WebSockets. For that you need to use the SendP or SendPF commands.

Examples

Example 1

This task catches messages for one area and bounces them to another area.

{
Start(0x1c,100,x,x,x,x,0xff)     //Trigger off any message for Area 100
Copy @0,~0,7      //Copy the whole message to tilde memory starting at ~0
LDA #2            //Load a value of 2 into the accumulator.
STA ~1            //Store it into the area byte of that message.
TX ~0,2,7         //Resend the message to the spur with the new area.
}

Example 2

This task responds to preset requests as if it was a load controller to update a touchscreen button for a dummy area.

Respond: DyNet(0x1C,15,0x00,0x62,0x00,0x00,0xFF)
----
{
Start(0x1C,15,0x00,0x63,0x00,0x00,0xFF)
Copy Respond,~10,7
LDA $11     //Load the current preset for the dummy area
STA ~13     //Store into the preset byte slot
TX ~10,2,7  //Sends the response onto the network.
}
----

Example 3

Copying from an archetypal message so we can edit the bytes and TX it out later.

OneTouch_Message: DyNet(0x1C,0x02,0x00,0x6B,0x00,0x00,0xFF)   //One Touch Message
Startup1()
{
Name="Start Task"
Copy OneTouch_Message, ~30,7 // Copy a default status message to ~30-36
}

Task1()
{
Name="Chase Display Update"
...
      LDA #SpeedCh	//Load the channel number for chase speed
      STA ~32	      //Store it into the channel byte
      LDA ~10          	//Load the chase speed
      STA ~33		//Store it into the preset byte
      TX ~30,0,7        //Mute it to the display to update the speed icon
      Null
}

Example 4

This task TX’s out a 0x6c message to check the state of some memories.

{
LDA #0x6C
STA ~40
LDA $Occupancy_State	//Load Occupancy State
STA ~41
LDA $222	            //Load Humidity refresh state
STA ~42
LDA ~17	            //Load lighting preset
STA ~43
LDA ^59,0	            //Load the state of the first 8 dipswtiches
STA ~44
LDA HVAC_State	      //Load HVAC state
STA ~45
LDA loopCounter  	      //Load number of times our chase has looped
STA ~46
TX ~40,2,7	            //Send it out so we can see the state of all these things
}

Example 5

Using TX command to send a message to the spur only.

Room_Occupied: DyNet(0x1C,200,0x00,0x00,0x00,0x00,0xFF)   //P1 for occupancy Bogus
Room_UnOccupied: DyNet(0x1C,200,0x00,0x03,0x00,0x00,0xFF) //P4 for occupancy Bogus

Task1()
{
Name="Room Occupied"
      TX Room_Occupied,2,7  //Send Room Occupied preset to spur only
      Null
}

Example 6

Using TX command to send a DyNet 2 message to the trunk only.

DayTimePreset: DyNet(0xAC,0x03,0x01,0x00,0x00,0x00,0xFD,0xE8,0xFF,0x00,0x01,0x00,0x00,0xC8)	// Area Day Night Tracking [65000]

Task1()
{
Name="Day Mode"
      TX DayTimePreset,5,14  //Send day mode preset to trunk
      Null
}