TechJunki

MrPLC Member
  • Content count

    253
  • Joined

  • Last visited

Community Reputation

0 Neutral

About TechJunki

  • Rank
    Sparky

Contact Methods

  • Website URL http://
  • ICQ 0

Profile Information

  • Location Midwest
  • Country United States
  1. Module Module1 Public RsLinxOPCServer As OPCAutomation.OPCServer Public WithEvents LinxOPCGroup As OPCAutomation.OPCGroup Public Sub AddOPCTags(ByVal Tags, ByVal NumOfTags) Dim AddItemServerErrors As System.Array Dim TagName As String Dim i As Integer ' OPC Item related data Dim ItemServerHandles As System.Array Dim OPCItemIDs(NumOfTags) As String Dim ClientHandles(NumOfTags) As Int32 'Create Server RsLinxOPCServer = New OPCAutomation.OPCServer 'Connect to Server RsLinxOPCServer.Connect("RSLinx OPC Server") 'Add Group to Server LinxOPCGroup = RsLinxOPCServer.OPCGroups.Add("MyGroup") 'Set Group Active for Data Updates and Events LinxOPCGroup.IsActive = False 'Group Update Rate LinxOPCGroup.UpdateRate = 500 LinxOPCGroup.IsSubscribed = False 'Add Items to Group, the specifier on the end Needs to be Unique for each Tag 'Lengths of Arrays Can Not be longer than 100 Elements or RSLINX Will Error For i = 1 To 1 TagName = "" & "MyTagArray,L8,C1" OPCItemIDs(i) = TagName ClientHandles(i) = i Next ' Add Items to RsLinx Server LinxOPCGroup.OPCItems.AddItems(NumOfTags, OPCItemIDs, ClientHandles, ItemServerHandles, AddItemServerErrors) End Sub Public Sub SyncRead(ByVal Tags) Dim CurrentServerState As Integer Dim ItemCount As Short Dim i As Integer ' Get Number of Items in Group From Server ItemCount = LinxOPCGroup.OPCItems.Count ' Dim Arrays for SyncRead Dim SyncServerHandles(ItemCount) As Integer Dim SyncErrors As System.Array Dim SyncValues As System.Array Dim SyncQualities As Object Dim SyncTime As Object ' Pass in the ServerHandles for the items For i = 1 To ItemCount SyncServerHandles(i) = LinxOPCGroup.OPCItems.Item(i).ServerHandle Next ' Read Items From Group LinxOPCGroup.SyncRead(1, ItemCount, SyncServerHandles, SyncValues, SyncErrors, SyncQualities, SyncTime) ' Copy Data to MyData Globals.MyData = SyncValues 'Remove Groups RsLinxOPCServer.OPCGroups.RemoveAll() ' Disconnect OPC Server RsLinxOPCServer.Disconnect() End Sub End Module
  2. I have an old time set sapplication which works fine in the old RsiOPCAuto.dll but after upgrading to Linx 2.58 it appears this dll is no longer included, and is switching to using the OPC DA Automation Wrapper, anyway this new Wrapper does not like the old "write" data structure. I am attempting to create the data structrure here in this screenshot, this is the structure that is returned when I do a read of the data points. I can modify/write this structure back to the PLC but can not figure how to make it from scratch using a DIM or Array.CreateInstance Statement or any other method for that matter. System.Array ---->System.Array ---------->Integer(8) Anyone have any ideas?? Thanks in advance....
  3. Simple Encoder

    Thanks I'll take a look at the pdf..
  4. Simple Encoder

    TW, do you have a sample of the periodic code you are using for your rate measurment you care to share as I am now beginning to implement this? Thanks for all the help with this.........
  5. iFix!

    You will need to use a Timer event to schedule the code to execute
  6. RSLinx DDE Comms Problem

    Glad you got it working... Sometimes better not to question if it works...
  7. I have a winder application that I need to measure speed and yardage on the roll. Has anyone had any experience interfacing a simple encoder such as a pulse encoder in to a high speed counter module for the logix and measuring speed and yardage. The winder currently is just an AC motor with a manual speed control, no feedback whatsoever. But I do have a contrologix PLC available and empty slots to accomidate a specialty card if necessary. What is the recommended practice or what have the rest of you been using for this type of application. Encoder Type?? Logix Module?? Thanks for any info..
  8. RSLinx DDE Comms Problem

    That is really strange, I was able to reproduce the problem, with a nine in the first element of the array it will "bomb" out VB6. I found that changing the Declaration datatype in the "Write" sub to a Variant seems to eliminate the problem. I tryed a few other datatypes all with out any success, either same thing or it just plain old didn't work. Must have something to do with how VB stores and sends the data in its memory. Anyway by changing the following line I have gotten this to work with a "9" as the first element of the array. let me know if you have the same result.. Dim WriteValues() As Integer --> Dim WriteValues() As Variant
  9. RSLinx DDE Comms Problem

    You could try posting or e-mailing your project file and I could take a look at it to see if it acts the same on my end. Not sure why it won't work correctly.
  10. RSLinx DDE Comms Problem

    I doubt it has anything to do with the setup in linx... Are you adding the items something like this....here is the rest of the code to add the items
  11. RSLinx DDE Comms Problem

    For VB6...almost the same Public Sub SyncWrite() ' Dim Arrays for SyncWrite Dim SyncServerHandles() As Long Dim Values() As Variant Dim WriteData Dim SyncErrors() As Long Dim ItemCount As Integer Dim WriteValues() As Integer ' Get Number of Items in Group From Server ItemCount = LinxOPCGroup.OPCItems.Count ' Redim Arrays for Item Count ReDim SyncServerHandles(ItemCount) ReDim Values(ItemCount) ReDim WriteData(ItemCount) ' Write values 1 to 10 to N63:500 to N63:509 and N63:510 to N63:519 ReDim WriteValues(9) ' Fill with Data For i = 0 To 9 WriteValues(i) = i + 1 Next ' Copy Array Data WriteData(1) = WriteValues 'Data to First Item in Group -- [TopicName]N63:500,L10,C1 WriteData(2) = WriteValues 'Data to Second Item in Group -- [TopicName]N63:510,L10,C1 ' Pass in the ServerHandles and Values for the items active in Linx For i = 1 To ItemCount ' Pass in ServerHandles SyncServerHandles(i) = LinxOPCGroup.OPCItems.Item(i).ServerHandle ' Pass in ClientHandles Values(i) = WriteData(LinxOPCGroup.OPCItems.Item(i).ClientHandle) Next ' Write data to server LinxOPCGroup.SyncWrite ItemCount, SyncServerHandles, Values, SyncErrors End Sub
  12. iFix!

    Try This Private Sub GetUser() Dim sUserId As String Dim sUserName As String Dim sGroupName As String System.FixGetUserInfo sUserId, sUserName, sGroupName If sUserId = "" Then CurrentUser.Caption = "Security Not Enabled" Exit Sub End If If sUserId = "ADMIN" Then 'Do Soemthing Here Exit Sub End If End Sub
  13. Thanks BobLfoot for catching that, I put it together pretty quick. I see the COP does in fact support String datatypes, I figured there was a better way to move strings.
  14. I would either use structured text (this is a whole other story), or you can just use the CONCAT function and make Source A the string you want to move, Source B would just be an empty string, and the destination is where you want to move the Source to.
  15. There may be a better way.... but quickly combining fuzzy logic's code and b_calton's "rules" it would look something like this.