Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

How to communicate with Compax3 via RS232

Solved!
Go to solution
private void initializeSerialPortToolStripMenuItem_Click(object sender, EventArgs e) // Enable serial port communication
        {
            string t;   
        t = serialPort1.PortName;
                sErial(t);

        }
            void sErial (String Port_name)
            {
                if (!serialPort1.IsOpen)
                {
                    serialPort1.Open();
                    serialPort1.WriteLine("o1.1\r");
                    serialPort1.ReadTimeout = 1000;
                    System.Threading.Thread.Sleep(10);
                    string Connected = serialPort1.ReadExisting();
                    if (Connected.Contains("Parker EME"))
                    {
                    richTextBox2.Text = "Connected to "+Connected+"!";
                    }
                    
                }
            }
            private void button1_Click(object sender, EventArgs e)//Reset fault button
            {
                string Reset = "o1905.1=1" + "\r";
                string Reset2 = "o1905.1=0" + "\r";
                string estop = "o1908.1=0\r";
                serialPort1.WriteLine(estop);
                System.Threading.Thread.Sleep(10);
                if (serialPort1.ReadExisting().Contains(">"))
                {
                    serialPort1.WriteLine(Reset2);
                    System.Threading.Thread.Sleep(10);
                    if (serialPort1.ReadExisting().Contains(">"))
                    {
                        serialPort1.WriteLine(Reset);
                        System.Threading.Thread.Sleep(10);
                        if (serialPort1.ReadExisting().Contains(">"))
                        {
                            string disable = "o1909.1=0\r";
                            serialPort1.WriteLine(disable);
                            System.Threading.Thread.Sleep(10);
                            if (serialPort1.ReadExisting().Contains(">"))
                            {
                                string enable = "o1909.1=1\r";
                                serialPort1.WriteLine(enable);
                                System.Threading.Thread.Sleep(10);
                                if (serialPort1.ReadExisting().Contains(">"))
                                {
                                    richTextBox2.Text = "Reset Command Sent Successfully";
                                }
                                else richTextBox2.Text = "Reset Command Not Accepted";
                            }
                            else richTextBox2.Text = "Reset Command Not Accepted";
                        }
                        else richTextBox2.Text = "Reset Command Not Accepted";
                    }
                    else richTextBox2.Text = "Reset Command Not Accepted";
                }
                else richTextBox2.Text = "Reset Command Not Accepted";
            }

private void button3_Click(object sender, EventArgs e) //stop button
        {
            if (serialPort1.IsOpen)
            {
                string stop = "o1901.1=0" + "\r";
                serialPort1.WriteLine(stop);
                richTextBox1.Text = "";
                System.Threading.Thread.Sleep(10);
                if (serialPort1.ReadExisting().Contains(">"))
                {
                    richTextBox2.Text = "Stop command Sent Successfully";
                }
                else richTextBox2.Text = "Stop Command Not Accepted";
            }
        }
        private void Send_Click(object sender, EventArgs e) //send manual text box data button
        {
            if (serialPort1.IsOpen)
            {
                string text = richTextBox1.Text + "\r";
                serialPort1.WriteLine(text);
                richTextBox1.Text = "";
                System.Threading.Thread.Sleep(10);
                if (serialPort1.ReadExisting().Contains(">"))
                {
                    richTextBox2.Text = "Manual Command Sent Successfully";
                }
                else richTextBox2.Text = "Manual Command Not Accepted";
            }
        }

        private void button2_Click(object sender, EventArgs e) //activate absolute positioning function and go to preset parameters.
        {
                string position = "o1901.2=" + textBox1.Text + "\r";
                string velocity = "o1902.2=" + textBox3.Text + "\r";
                string acceleration = "o1903.2=" + textBox4.Text + "\r";
                string deceleration = "o1904.2=" + textBox2.Text + "\r";
                string jerk = "o1905.2=" + "10" + "\r";
                string jerkdecel = "o1906.2=" + "10000" + "\r";

 

0 Kudos
Message 51 of 88
(5,712 Views)

Hi Mel-D,

 

You may consider activating the limit and home sensors.

Also, converting INT to BOOL is a tedious job. There are two control words and two status words (which are meant for inputs and outputs respectively, but may be used in any fashion). Check for the objects 1100.3 and 1100.4 for control words and 1000.3 and 1000.4 for status words.

 

If your format is DDDDDDD.DD, then you should use 1100003.01 for refering to the second bit. If you were to write a codesys program and activate any block via the control word, you should use C3Plus.DeviceControl.ControlWord1.1 at the execute of that block.

 

Hope this helps.

 

-Vijay.

-Regards,
Vijay,
Application Engineer,
Parker Hannifin.
0 Kudos
Message 52 of 88
(5,700 Views)

Anyone know how to retain the positioning data in codesys after a power failure?  I know you can write objects to 20.11 and read from 20.10 but how do I do that internally with codesys?  And how do I write the correct position?  Every time I do a power cycle it sets the position to 0.00000 no matter where the stage is located.  When I try to write to 20.11 (C3.ObjectDir_WriteObjects) within codesys my program won't enable MC_Power and stays in the power on state without drive enabled.

 

Thanks and this thread has helped me quite a bit already, given the shotty documentation with these drives.

 

0 Kudos
Message 53 of 88
(5,652 Views)

Unless you ordered an absolute encoder for your motor and the Compax3 option to match, that is how it is supposed to work.  If you only have an incremental encoder, which is common, then you need to home after a power cycle.

0 Kudos
Message 54 of 88
(5,646 Views)

Hi,

 

While you define the homing mode in the configuration wizard of C3Servo Manager software, there is a place where you can select "Multiturn Emulation". Make that option selected and give a valid window in the range of 1 to 180 degrees.

 

Now, when you perform a power cycle, postion will be retained; provided you don't manually move the shaft of the motor beyond the value specified in the valid window!

 

Hope this helps.

 

-Regards,
Vijay,
Application Engineer,
Parker Hannifin.
0 Kudos
Message 55 of 88
(5,641 Views)

Hi guys!

 

My group are writing our bachelor project on a Hexapod (Stewart platform) with 6 Parker actuators and motors, and we are using a Compax3
Model C3S025V2 F10 I10 T10 MOO. We are using Servo Manager, Windows 7 computer, the specifications/requierments are fulfilled. We are trying to communicate with the Compax3 using a Serial to USB adapter (RS232), we are able to set the COM port on ServoManager to the right port where the USB is connected, but the ServoManager apperently dose`nt see that the COM port is a USB.

 

Whenever we try to set the ServoManager up with the "Online Device Identification" the error is:

"Device identification error.
No valid compax3 unit detected.
No compax3 identity string found.

COM: wrong COM port?
COM: no compax3 connected?"

We know that it is the right COM port, and the compax3 is connected with an external 24VDC power supply.
Our toughts are that maybe the Serial to USB adapter is not compatible with Win7, we have tried with different Serial to USB adapter cables with no luck.

Any ideas? 

 

0 Kudos
Message 56 of 88
(5,567 Views)

ES,

 

I am using a USB->Serial adapter and I had similar problems getting it to work. My problem ended up being driver related, so I'd make sure to go to your adapters website and get their Win7 driver.

I'm not familiar with your model of Compax3, but you could try using a different communication method (like direct serial) if it's available.

You can try using the Device Setup wizard as well if you find the adapter is working properly.

Let us know what you try and the outcome.

Thanks,

Tim

________________________________________________________

Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
using LV 2010 SP 1, Windows 7
________________________________________________________
0 Kudos
Message 57 of 88
(5,562 Views)

Hi Tim!

Thank you for answering, I have attached a picture of the Serial to USB cable, can`t figure out whos the manufacture... :-S
We have made some progress, we had a old computer with XP installed, and a old "VGA" input, where we could connect it directly to X10 on the compax3.
This actually works, and we can communicate with the Compax3, this again points to what you are saying that it is driver related to the Win7 machine.

 

We are trying now to "play around" in servomanager just to learn the program and follow some guides, but I`ll write you guys a update as soon as we know something about the Win7 machine. And if there is a driver that will enable us to communicate with the compax3 🙂

 

Thanks, 
ES

0 Kudos
Message 58 of 88
(5,558 Views)

Hi,

 

I hope this link helps!

http://www.parkermotion.com/dmxreadyv2/faqsmanager/faqsmanager.asp?question=948

 


I've personally used Bafo, Moxa and TrendNet make converters. These are proven to work on a Windows 7 machine with "prolific" drivers. You could try uninstalling the driver of your USB to Serial converter from "Device Manager" and install this driver (and then plug in the converter).

 

-Regards,
Vijay,
Application Engineer,
Parker Hannifin.
0 Kudos
Message 59 of 88
(5,547 Views)

Thanks V_K.
We went through that list 🙂
What we figured out today was that the cable we used was "out dated" compared to windows 7. Because it was a USB 1.0, when we recived a newer cable with USB 2.0 it worked like a DREAM 😄

 

Will make a new post in the forum with the project we are dealing with, different problems and offcourse our solution to the different problems, so people in the future hopefully will find some help in our problems and solutions 🙂

0 Kudos
Message 60 of 88
(5,534 Views)