OPN

Top  Previous  Next

 

Open data block.

 

If you need data out of the same data block inside a program part quite often you will have to ‘open’ it. Addressing data words you do not have to specify in the following in which DB they are, the PLC takes them automatically out of the opened data block.

 

Warning: If you call an operand with the full qualified access while working with an opened DB the corresponding DB will be opened automatically! Example:

 


OPN

DB 10



L

DBW 20

// The DW 20 of the DB 10 is stored in accu 1


L

DB30.DBW 40

// The DW 40 of the DB 30 is stored in accu 1


L

DBW 20

// The DW 20 of the DB 30 is stored in accu 1

 

Internally the global DB register of the CPU is loaded with the specified DB by the operation OPN.

 

You can use the operation OPN with the syntax OPN DB as well as with OPN DI xx. In this case the global DB register is not loaded with the specified DB but the instance DB register. All accesses to data that contains an ‘I’ (DIX, DIB, DIW or DID) relates to the so opened DB subsequently. Attention: Even all operands that are marked with ‘#’ that are not out of the TEMP area are now in the DB that is opened as OPN DI.xx!

 

You can load the number of the just opened DB/IDB with L DBNO/DINO into accu 1.

 

See also:

CALL

CC

UC

 

List of operations