PLC Indirect Addressing
We can very easily perform many operations such as creating an error routine with indirect addressing method in PLCs, recipe system, and methods of storing the data we have.
What is indirect addressing, in a briefly understandable way;
The process of selecting the elements of an array by an index number can be called indirect addressing.
Let’s have a barcode and show the last 10 of the read barcodes. First of all, whenever a barcode value arrives, we must have an index tag and this index tag should indicate which order it is.
The index tag should increment 1 whenever a barcode value arrives, and reset itself when it reaches a value of 10.
Indirect Addressing Instructions
For this, we can use the EQU instruction or we can count it with the CTU instruction and use the Done bit of the CTU command to reset the index tag counter with the RES command.
In order to store the barcodes in one place, we must create an Array according to the barcode type and store it in it.
The Array type must be the same as the Barcode variable type, otherwise, we cannot assign the Barcode data to the array in the Array.Assuming that the Barcode variable is a DINT value,
Create PLC Tags
TagName : Barcode
DataType : DINT
BarcodeList Tag will keep the last 10 Barcodes.
In order to understand the incoming barcode, if the previous barcode is different from the next barcode, we increase the counter by one and save it in our array according to the index number.
As a result, our PLC program can record the last 10 barcode numbers in a sequence, as follows, or you can make the array two-dimensional and record which time and date the barcode arrived.
If you have any questions, feel free to contact us.