Some tips and pointers on using Pointers

In another thread that started on the topic of choosing tag/variable names, we ventured into several other topics, including using init files, FlagLock/Unlock commands, and pointers:…&p=350#post350

The question was asked: How are others using pointers?

I hope many of you are using the Example strategy called IO_Enabler for Enet & PAC Brains (installed with PAC Control), which will automatically re-enable I/O Units that have become disabled.

In IO_Enabler_Chart’s pink block (Block 1, called User Initialization) you can see where a Pointer Table is used to create a list of all the I/O Units in your strategy you want this IO_Enabler_Chart to re-enable for you. The code can then loop through the list and act on each of many (or even just one) of the I/O Unit’s you’d like it to re-enable for you.

That’s my favorite use of pointers.

Anyone else?


I use pointers on almost every project. The best example of pointer use is to control a large group of similar pieces of equipment such as a rock crusher operation. In this case I had multiple conveyors and crushers and shakers, etc., etc. I was able to incorporate all 70 pieces of logic into a chart which consisted of the logic for only one piece.

Additional differences or additions can also be added into this logic simply by using a condition looking for a specific set of indexes in the main logic tree to branch for these special cases.

I use mostly tag variables instead of tables for the variables because it is easier to troubleshoot and the controller is so fast it can easily move all the values to and from the registers and brains without using tables.

Anyway the strategy only consisted of one chart to control all 70 pieces. The real beauty of this design is that during the troubleshooting necessary for most of less than perfect programmers, fixing all 70 logic loops is done in one place only once!