Jump to content
Sign in to follow this  
cmarcus

Connecting Over Network

Recommended Posts

Hello,

I'm having an issue with getting the .NET driver to connect and read values.  I am having no problems connecting using Visilogic, but when I take those properties and use them in the .NET driver they don't seem to be working.  The interesting this is that I'm not getting an exception, so my application believes the driver is connected, but looking at the properties for the Ethernet object it appears not to be.

When I put a break point on the oPLC object, it states that the object could not be evaluated because the previous function had timed out. 

When run it down to the last line and check the response values it is null.

Here's the code:

                Ethernet ethernet = new Ethernet(_cell1PLC_IP, _cell1PLC_Port, EthProtocol.TCP,  3, 3000);                
                PLC oPLC = PLCFactory.GetPLC(ethernet, 1);
                oPLC.SetExecuter(OperandsExecuterType.ExecuterPartialBinaryMix);

                // Create the write request //
                ReadWriteRequest[] readShifts = new ReadWriteRequest[1];
                readShifts[0] = new ReadOperands
                {
                    NumberOfOperands = 1,
                    OperandType = OperandTypes.MB,
                    StartAddress = 0,
                };

                // Extract the shift times //                
                object[] shiftTimes = ((object[])readShifts[0].ResponseValues);

oPLC breakpoint.jpg

Share this post


Link to post
Share on other sites

Hi, 

Your code is is missing the actual call to the PLC.

You create the ReadWriteRequest array, but do nothing with it.

 

You should call oPLC.ReadWrite(ref  readShifts );

 

Share this post


Link to post
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.
Note: Your post will require moderator approval before it will be visible.

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.

Sign in to follow this  

×
×
  • Create New...