Topic: DMD0345

Help File Version: 2.9.4.37

PING - Ping Ethernet Device


The Ping Ethernet Device (PING) instruction uses the Internet Control Message protocol (ICMP) to determine if the device with the specified IP Address is available on the network, and optionally to report the amount of time required to get a response from that device.

 

The amount of time required to complete the PING operation can optionally be stored in a numeric location. The round trip time begins accumulating when the PING packet is actually sent and ends with either a response from the remote device or a timeout. If the PING operation is successful, the Round Trip Time will be total amount of time (in milliseconds) that elapsed after the PING packet was sent and the response packet was received. If the PING operation failed, the Round Trip Time will be the total mount of time (in milliseconds) that elapsed while waiting for the timeout to occur.

 

Note: care must be taken to NOT run this instruction at an uncontrolled pace. If this happens the network hardware could perceive it as a Ping Flood (where ICMP packets are sent as fast as possible without waiting for replies). This could lead to a DENIAL-OF-SERVICE for legitimate PING operations.

 

 


Parameters:

Note: Use the F9 key to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.

 

Device selects which of the Ethernet Devices to use, currently this instruction can only use @IntEthernet which is the on-board Ethernet port on the Do-more CPU. If the only entry in the list is no devices available this indicates that there are no Devices that can execute this instruction, most likely cause is the CPU does not have an on-board Ethernet port.

 


Remote Address is the address of the remote network device to attempt to locate.

 

  • Select Fixed Address if the IP Address assigned to the DNS Server. IP addresses are canonically represented in dot-decimal notation, consisting of four decimal numbers, each ranging from 0 to 255, separated by dots.

  • Select Variable IP Address if the IP Address resides in a memory location in the CPU. This allows the IP Address to be changed at runtime. This can be any readable DWord numeric location. Each octet of the IP Address is stored in one byte of the Variable Address location. In the example below the Initialize Data instruction will use the :UB operator to place the 4 octet values of IP Address 192.168.26.71 into the 4 Bytes of the DWord location D0 in the proper order. Note: the 'IP Address' format selection in a Data View can be used to see the IP Address stored in the DWord location in the traditional dot-decimal notation (000.000.000.000).



  • Select Slave ID if the remote target is an ECOM100 or EBC100 that is using a numeric value as its identifier. This can be a constant value from 1 to 90 (for ECOM100s), from 0 to 65535 (for EBC100s), or a numeric memory location with a value in those ranges. Note: this selection does not perform an actual PING instruction like the other two selections because it is not using an IP address to locate the target device. It will perform a network broadcast looking for an ECOM100 or EBC100 that has been configured with the specified Slave ID.

Network Adapter: because this selection uses Ethernet broadcasts to send packets, you must select which of the Ethernet ports to send packets through:

Default means the TCP stack will route the packets to the first Ethernet port that can process the packet; on CPUs without a Secondary port (BX-P-ECOMEX) this will always be the on-board port. This is also the proper selection for backwards compatibility with previous Do-more Technology versions and with H2-DM1E, T1H-DM1E, and BX-DM1 CPUs because they have no provision for a Secondary Ethernet port.

 

Primary (Internal Ethernet) will send packets through the on-board Ethernet port of the Do-more CPU.

 

Secondary (BRX ECOMEX) will send packets through the BRX CPU's secondary Ethernet port (BX-P-ECOMEX).


Network Timeout specifies the amount of time (in milliseconds) to wait on a response from the network device. This can be any constant value between 1 and 65535, or any numeric location containing a value in that range.

 

If the optional Round Trip Time is enabled, this specifies a numeric memory location to store the total amount of time (in milliseconds) that elapsed during the Ping operation. This can be any writable numeric location.

 


The On Success and On Error parameters specify what action to perform when this instruction completes. You do not have to use the same type of selection for both On Success and On Error.

 

If the Set Bit selection is used for either On Success or On Error, the specified BIT location will be SET OFF when the instruction is first enabled and will remain OFF until the instruction completes. Once complete, the appropriate Success or Error bit location ON. The specified Bit location is enabled with a SET (Latch) operation meaning that it will remain ON even if the input logic for the instruction goes OFF.

 

If the JMP to Stage selection is used for either On Success or On Error the target Stage must be in the same Program code-block as this instruction, you cannot specify a target Stage that exists in a different Program code-block. When the operation finishes, the target Stage will be enabled the same way as a standalone Jump to Stage (JMP) instruction would do it. The JMP to Stage option will only be available if this instruction is placed in a Program code-block.

 

On Success selects which of the following actions to perform if the operation is successful:

  • Enable SET Bit then specify any writable bit location.
  • Enable JMP to Stage then specify any Stage number from S0 to S127 in the current Program code-block.

 

On Error selects which of the following actions to perform if the operation is unsuccessful:
 

  • Enable SET Bit then specify writable bit location.
  • Enable JMP to Stage then specify any Stage number from S0 to S127 in the current Program code-block.

 

If either the On Success or On Error selections are set to JMP to Stage, Automatically create the SG box for any NEW stage number will be enabled which will automatically create any target stage that does not already exist.

  • Below this rung will create the new target stage on a new rung following this instruction.
  • At end of code-block will create the new target stage as the last rung of this Program.

 


Status Display:

 

The red triangle in the upper left corner of the status display indicates this is a Fully Asynchronous instruction.

 

The gray triangle at the right end of the input leg indicates the input is edge-triggered, meaning this instruction will execute each time the input logic transitions from OFF to ON.

 


See Also:

DNSLOOKUP - Name to IP Address

 

NETTIME - SNTP Client

 

PING - Ping Ethernet Device

 


Related Topics

Lookup IP Address

 


Example Using Stages:

 


Rung Example: