Insert-Update w/ Single PLC
This DirectSoft project scans for switch state changes (X0-X15) and sends a message to DataWorx if a switch has been toggled. With the ACK feature it detects if DataWorx received the message. If the PLC does not receive confirmation it will send the message again every second until it receives confirmation. Additionally, if there are more switch toggles it will store the switch notifications onto a pending buffer list so no switch states will be lost.
This example will demonstrate how to use DataWorx create and populate records with more data than can be contained in a single WX message.
The basic method for accomplishing this is to execute an Insert procedure to create a new record with a unique key and some initial data, and then subsequently adding additional data to the record by executing Update procedures and using the same unique key to identify the record.
Even though several different procedures will be executed, the ladder needs to have only one WX instruction and set of reserved memory locations. In order to accomplish this, set the WX instruction to send as much data as needed for the largest procedure. For example, if you have two procedures that send 10 and 20 bytes of data, set the WX to accommodate 20 bytes of data. DataWorx will ignore the extra data when the 10 byte procedure is executed. Then, before executing each procedure, copy the appropriate data into the designated memory locations that will be used by the WX. This is demonstrated in the project.
In order to have the Update procedures successfully follow an Insert or other Update procedures, the PLC needs to wait for a confirmation from DataWorx using an RX instruction. After sending the DataWorx WX, have the PLC periodically perform an RX request from DataWorx to check on the status of the procedure.
There are three possible results of a DataWorx RX confirmation:
Note that the samples are saved in ZIP format. You may need to download additional software in order to open ZIP files. A free ZIP file application can be downloaded at www.winzip.com