Topic: DMD0061

Help File Version: 2.10.0.636

DEVCLEAR - Clear Device


The Clear Device (DEVCLEAR) instruction is used to clear the internal data storage of the selected Device or Device Reference. The actions that are done when a Clear Device operation is performed depend on the type of Device that is selected.

 

 


Parameters:

Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field 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 configured Devices or Device Reference to close.

 

No devices available means there is no device that is appropriate for this instruction. Select one of the following to create the required device:

create device will open the Device Configuration dialog of the System Configuration to create a new device of the appropriate type
 

create module will open the Module Configuration dialog of the System Configuration to create a new module configuration that can provide a device of the appropriate type

The specific actions performed during a Clear Device operation depend on the type of device that is selected. Refer to the following types of Devices:

 

UDP Connection - any data in the Input Queue is deleted. Clearing the input buffer will also reset the .PacketAvailable flag in the UDP Connection's associated structure. Any data in the Output Queue is deleted.

 

TCP Client - if Connected is ON, any data in the Input Queue is deleted and any data in the Output Queue is deleted.

 

TCP Server - any data in the Input Queue is deleted. Any data in the Output Queue is deleted.

 

On-board Serial port (@IntSerial) when configured as General Purpose - any data in the Input Queue is deleted. Clearing the input buffer will also reset the .InQueue value in the associated structure. Any data in the Output Queue is deleted. Clearing the output buffer will also reset the .OutQueue value in the associated structure. The Serial Status register is cleared. The Serial Control register is cleared .

 

Serial port on SERIO / SERIO-4 Module when configured as General Purpose - any data in the Input Queue is deleted. Clearing the input buffer will also reset the .InQueue value in the associated structure. Any data in the Output Queue is deleted. Clearing the output buffer will also reset the .OutQueue value in the associated structure. The Serial Status register is cleared. The Serial Control register is cleared .

 

RS232 & RS485 Serial POMs (@POM) when configured as General Purpose - any data in the Input Queue is deleted. Clearing the input buffer will also reset the .InQueue value in the associated structure. Any data in the Output Queue is deleted. Clearing the output buffer will also reset the .OutQueue value in the associated structure. The Serial Status register is cleared. The Serial Control register is cleared .


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:

CLOSE - Close Device

 

OPENDEV - Open Device

 

DEVCLEAR - Clear Device

 

DEVREAD - Read Device Register

 

DEVWRITE - Write Device Register

 


Related Topics:

For more information on Devices, Device References, and how to configure them go to the Device Configuration.

 

PACKETIN - Input Data from Packet Device

 

PACKETOUT - Output Data to Packet Device

 

STREAMIN - Stream In Data from Device

 

STREAMOUT - Stream Out Data to Device

 


Rung Example: