Skip to content

0. Writing your First SEC Node

Peter Wegmann edited this page Sep 17, 2024 · 7 revisions

Writing a SEC node is divided into three distinct sections. The vi random-demo/dcy06.vi represents a complete example, alongside which the three sections are explained in detail. It is encouraged to make yourself familiar with the basics of SECoP before you start.

In this Section the SHALL Librarys are initialised and the Structure of the SEC Node is specified. After you have specified all SEC Nodes, the Node Complete Vi has to be called to finish initialisation.

The main loop can be subdivided further into two sections. First the Get Command loop, that calls GET CMD or GET CMD2 in an infinite loop. It´s purpose is to handle all requests coming from clients, to read fresh data from the hardware, set values, or execute SECoP commands. Furethermore if a pollinterval is set for certain Parameters, the library generates read requestes acording to the time set in the pollinterval. The second section is somewhat optional and would represent your existing project. Here you can just add UPDATE PARAM or UPDATE PARAM Vis everytime you read from the Hardware. This ensures that clients connected to the SEC node receive fresh data, when it is available.

The Exit Vi ensures that all nodes that were started inside a given Vi are stopped and removed from the environment. A special eventhandler that is triggered on Panel Close ensures that the nodes are removed even if the panel window is closed without pressing the stop button. Otherwise the node would remain runnign in the background as long as the LabVIEW process is running.

Clone this wiki locally