Unicornai Posted April 19 Share Posted April 19 Thanks Quote Link to comment Share on other sites More sharing options...
Alex Anikstein Posted April 22 Share Posted April 22 If they can be started at the same time and end at the same time, it would be easiest to just set both up as a single data gather and pretend you're only gathering "one" thing. Alternately, add all items to the list of items to gather, then start it when either set wants to be gathered and stop it when both sets are done. If they need to be more independent, you are probably better off gathering them manually. You could do something like: GLOBAL GatherFlag1 = 0 GLOBAL GatherFlag2 = 0 GLOBAL MaxItems1 = 4000 GLOBAL MaxItems2 = 3000 GLOBAL Offset = 10 GLOBAL NumItems1 = 2 GLOBAL NumItems2 = 3 GLOBAL Index1 = 0 GLOBAL Index2 = 0 OPEN PLC 0 //This will run at the RTI; you could also do the same as User-Written Servo/Phase Algorithm in C and run it at Servo/Phase LOCAL Temp If(GatherFlag1 == 1) { Temp = Index1 + Offset Sys.Fdata[Temp] = <<First Item to Gather>> Index1 = Index1+1 Temp = Index1 + Offset Sys.Fdata[Temp] = <<Second Item to Gather>> Temp = MaxItems1 - NumItems1 IF(Index1 > Temp) //Maximum before reaching end of Gather 1's Range { Index1 = 0 // Roll Over back to 0 } ELSE { Index1 = Index1+1 } } If(GatherFlag2== 1) { Temp = Index2 + MaxItems1 + Offset Sys.Fdata[Temp] = <<First Item to Gather>> Index2 = Index2+1 Temp = Index2 + MaxItems1 + Offset Sys.Fdata[Temp] = <<Second Item to Gather>> Index2 = Index2+1 Temp = Index2 + MaxItems1 + Offset Sys.Fdata[Temp] = <<Third Item to Gather>> Temp = MaxItems2 - NumItems2 IF(Index2 > Temp) //Maximum before reaching end of Gather 2's Range { Index2 = 0 // Roll Over back to 0 } ELSE { Index2 = Index2+1 } } CLOSE Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.