Ethernet communications (Fanuc Robotics)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Ethernet communications (Fanuc Robotics)

  1. #1
    Join Date
    Dec 2013
    Location
    SLC Utah
    Posts
    1

    Ethernet communications (Fanuc Robotics)

    My code below removes the first character from the string received.
    but only every other time it is processed.

    could you tell me why?

    I am using c# in 2010 visual express.
    I could look for the version of .net I am using if I knew where to look.
    The other person I was collaborating on this job with is off for the holidays and I am left to figure it out with all the help I can muster.

    Thanks for the help.

    // Parse the data that we get from the Robot
    private void ParseData(string data)
    {
    // Make sure that the list of points is clear so we do not send double the data
    if (ListXYPoints != null)
    {
    ListXYPoints.Clear();
    }

    //MessageBox.Show(data);
    //Get rid of the parens, comma's etc.
    string[] split = data.Split(new Char[] { '(', ')', ',', ' ','"','\n','\r'}, StringSplitOptions.RemoveEmptyEntries);
    try
    {
    //Did we split it correctly?
    if (split[0].Equals("TRIGGER<SPACE>CogJob1<SPACE>"))
    {

    // ignore the CR at the end of the split data
    for (int i = 1; i < split.Length-1; i++)
    {
    try
    {
    ListXYPoints.Add(double.Parse(split[i]));
    //MessageBox.Show(split[i]);
    }
    catch (Exception e)
    {
    /// Display Open Port Result
    rtbTCPIPServer.Invoke(new EventHandler(delegate
    {
    rtbTCPIPServer.SelectedText = string.Empty;
    rtbTCPIPServer.SelectionFont = new Font(rtbTCPIPServer.SelectionFont, FontStyle.Bold);
    rtbTCPIPServer.SelectionColor = Color.Black;
    rtbTCPIPServer.AppendText(String.Format("Cannot parse data correctly, bad characters\n", e.ToString() + DateTime.Now.ToString("HH:mm:ss:") + DateTime.Now.Millisecond.ToString()));
    rtbTCPIPServer.ScrollToCaret();
    }));
    }
    }
    }

    else
    {
    /// Display Open Port Result
    rtbTCPIPServer.Invoke(new EventHandler(delegate
    {
    rtbTCPIPServer.SelectedText = string.Empty;
    rtbTCPIPServer.SelectionFont = new Font(rtbTCPIPServer.SelectionFont, FontStyle.Bold);
    rtbTCPIPServer.SelectionColor = Color.Black;
    rtbTCPIPServer.AppendText(String.Format("{0} Incorrect data format\n", DateTime.Now.ToString("HH:mm:ss:") + DateTime.Now.Millisecond.ToString()));
    rtbTCPIPServer.ScrollToCaret();
    }));
    }
    }
    catch (SocketException ex)
    {
    MessageBox.Show(ex.ToString());
    }

    cogToolBlockEditV21.Subject.Inputs["Positions"].Value = ListXYPoints;
    }

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,441

    Re: Ethernet communications (Fanuc Robotics)

    Copy the class into a test app and manually feed it data twice while stepping through the code in a debugger.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center