Jump to content
OMRON Forums

I want to collect two sets of data simultaneously, but it must be done simultaneously. What function should I use to achieve this requirement of simultaneous collection?


Unicornai

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...