# Reading data from global variables using an iodata in node

You can read data from global variables and inject them into a flow.

Using multiple data-handling nodes with small polling intervals may overburden the CPU and slow down the device. Whenever possible, use only one node to handle all data and modify the data using other nodes.

The output format of the iodata in node depends on the IEC 61131-3 data type of the related global variable, e. g. INT may yield a positive or negative integer while WORD always yields a positive integer.

1. Prerequisite
2. You must create global variables in the real-time application and deploy the changes, before you can use these global variables in Node-RED.

1. Open Node-RED.
2. Add an iodata in node from the Weidmüller category to the workspace.
3. Double-click the iodata in node to open the Edit node dialogue.
4. In the Mode drop-down list, select whether you want to fetch a single global variable or all global variables.
5. If you selected the single variable mode, select the variable you want to fetch in the Variable drop-down list.

6. If the desired variable is not displayed, check whether you have created that variable and deployed the changes.

7. In the Polling frame, specify the polling interval by entering a value in the text box and selecting a unit from the drop-down list.

8. Specify polling intervals as large as possible to reduce CPU load.

9. Click Done to apply your changes.
10. Add more nodes to the workspace and connect them to a flow with the iodata in node being the first node.

11. The upper output of the iodata in node emits process data accessible by array index.

    The output below emits process data accessible by variable name.

1. After deploying the flow, the iodata in node injects a message containing the variable data into the flow at the specified polling interval.

Creating a global variable

Deploying changes to the real-time application