b16mcc
Member
Hi guys. I have a challenge that I'm struggling with and I can't help thinking there's a really easy solution.
I want to move a series of individual REAL values from existing DB locations into an array to be passed to a Modbus client. I don't need to get into modbus , I've got that covered.
I simply want to collate the data. I was thinking my best bet would be SCL. So that's where I started.
I have this very simple code, but of course it's not correct and this is where I'm hung up.
So, you can see I tried making a temp string to address my inputs. My inputs are :-
SourceData1, SourceData 2 , etc etc , up to 32.
So you can see that on each pass of the loop the string #Input becomes 'SourceData1' , then 'SourceData2' and so on.
The output from the block is an array of REAL called Reg4000.
I have some VB coding experience , now this may be clouding my judgement somewhat here, but what I'm trying to achieve is what would be in VB ,
Of course maybe my approach is flawed from the outset.
So my problem is simply, How can I loop through my inputs without them being an array.
Thanks for looking..
Martin.
I want to move a series of individual REAL values from existing DB locations into an array to be passed to a Modbus client. I don't need to get into modbus , I've got that covered.
I simply want to collate the data. I was thinking my best bet would be SCL. So that's where I started.
I have this very simple code, but of course it's not correct and this is where I'm hung up.
Code:
FOR #Counter := 1 TO 32 DO
#Input := CONCAT(IN1 := 'SourceData', IN2 := INT_TO_STRING(#Counter));
#Reg4000[#Counter] := #Input;
END_FOR;
So, you can see I tried making a temp string to address my inputs. My inputs are :-
SourceData1, SourceData 2 , etc etc , up to 32.
So you can see that on each pass of the loop the string #Input becomes 'SourceData1' , then 'SourceData2' and so on.
The output from the block is an array of REAL called Reg4000.
I have some VB coding experience , now this may be clouding my judgement somewhat here, but what I'm trying to achieve is what would be in VB ,
Code:
Reg4000[#counter]=#Input.value
Of course maybe my approach is flawed from the outset.
So my problem is simply, How can I loop through my inputs without them being an array.
Thanks for looking..
Martin.