As shown in the current example (GPIO_TEST5), we can solve this problem by applying the principle of Separation of Concerns:
- First, as shown below, we move all the I/O interface blocks into one or more Resources separate from the program logic (here the resource is named IO for obvious reasons).
- Then we add Local Multicast blocks to transmit inputs to and receive outputs from other Resources.
- The Tagged Data design pattern support in the FBDK helps to keep the use of Local Multicast channels consistent among Resources.
Now we add Local Multicast blocks to the LOGIC resource to receive data from inputs and transmit the results of the control logic to outputs. Notice the reduction of diagram clutter:
In the next example, we'll take advantage of this reduced clutter to make room for more complicated control logic.