If you wish to access My_Array then you have first determine where in memory My_Array exists.
I think my problem is that I'm using an FB instead of an FC... I can't do something like T DBW [#ADDRESS], where #address is a pointer value. Because I can't define a pointer in the local symbol table. That data type is not available.
[sorry for the break in posts but this connection is unreliable.]
A DBpointer (called a pointer to confuse matters) can only be specified as a IN/IN_OUT/OUT/RET_VAL to an FC/FB - you cannot declare one in your stat/temp area.
When you call an FC/FB with a pointer parameter, the editor automatically inserts code that determines the DB number and the area pointer for the variable you have entered. This data is passed to the FC/FB and again to confuse matters, you can only access the DBnumber and area pointer values in the called FC/FB by using indirect addressing......
bytes/words confused here....
You are almost there.
Define ADDRESS as a TEMP doubleword. This value must contain the bit number of the first bit in your DBW. It means DBW10 will need the value 10*8=80 in your ADDRESS pointer.
In coding:
L 10 // My DBW number (eg. the first byte no), coming from wherever, whoever...
SLD 3 // Multiply with 8; calculate the bit address
T #ADDRESS
L DBW[#ADDESS] // Here's your value from DBW10
Kalle
L #S_Count_Array_Pos
SLD 3
T #S_Count_Array_Pos
L #S_Counter
[COLOR="Red"]T LW[#S_Count_Array_Pos][/COLOR]
// (Also tried T DBW[#S_Count_Array_Pos] and was still an invalid statement.)
Hey, this kind of makes sense to me... But, I tried a form of what you said and it didn't seem to work. I made #S_Count_Array_Pos a STAT DWord (since I want the value to carry over on the next FB execution)
Code:L #S_Count_Array_Pos SLD 3 T #S_Count_Array_Pos L #S_Counter [COLOR=Red]T LW[#S_Count_Array_Pos][/COLOR] // (Also tried T DBW[#S_Count_Array_Pos] and was still an invalid statement.)
You must copy the value to an LD (TEMP) or (heaven forbid) an MD to make it a legal pointer
Sorry, but you are not. I'll let Kalle continue with the multiple instance hurdle.
L #S_Count_Array_Pos
SLD 3
T #Temp_Pointer
L #S_Counter
T LW [#Temp_Pointer]