Galaniz
Member
I have a question regarding the use of indirect addressing and pointers. Is there a difference between using the SLW3 and multiplying the original value by 8. For my example I am indexing tank Volumes. "INDEX_VOLUMES" DBW48 has an integer 0-44 in multiples of four that reflects the desired starting byte in the "INDEX_VOLUMES" DB(selected on HMI).
OPN "INDEX_VOLUMES" //OPEN INDEX DB
L DBW 48 //LOAD INDEX NUMBER
SLW 3 // CONVERT INDEX NUMBER TO POINTER
LAR1 // LOAD POINTER TO ACCUM 1
L DBD [AR1,P#0.0] // LOAD VALUE IN DB210.DBD[DBW48]
T "HEADER A AUTO TRANS DB".HA_BARLS_DEST_TANK // STORE LOADED VALUE AS CURRENT BARRELS IN DESTINATION TANK
Can I replace the SLW 3 with the following:
L 4
*I
LAR1
?
I am learning that the AR1 part of the pointer [AR1, P#0.0] is like a bit starting point? It tells the program which bit number to start at?
Thanks,
OPN "INDEX_VOLUMES" //OPEN INDEX DB
L DBW 48 //LOAD INDEX NUMBER
SLW 3 // CONVERT INDEX NUMBER TO POINTER
LAR1 // LOAD POINTER TO ACCUM 1
L DBD [AR1,P#0.0] // LOAD VALUE IN DB210.DBD[DBW48]
T "HEADER A AUTO TRANS DB".HA_BARLS_DEST_TANK // STORE LOADED VALUE AS CURRENT BARRELS IN DESTINATION TANK
Can I replace the SLW 3 with the following:
L 4
*I
LAR1
?
I am learning that the AR1 part of the pointer [AR1, P#0.0] is like a bit starting point? It tells the program which bit number to start at?
Thanks,