LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus TCP Communication to Festo Drive

Solved!
Go to solution

Dave,

 

Currently strugglening with the FHPP myself, would you be willing to share your code ? I understand that Peter can not share his, although the bits he left were imensly usefull.

 

In advance thanks.

 

/søren

0 Kudos
Message 11 of 36
(3,422 Views)

Hi Sören,

 

I recently wrote my own driver for a Festo CMMO-ST device.

As the Modbus messages used by the device are so easy to build/parse I went for simple TCP messages (instead of any Modbus library in between).

 

Parsing the FHHP message looks like this:

check.png

(Basically get the 8 data bytes of the FHPP message and put them in a cluster.)

Creating the FHPP bytes is also quite easy:

check2.png

I'm using the CMMO-ST to drive a stepper motor. I only need to go to certain positions and use it's semi-automatic auto-referencing at startup.

 

When following the Festo manual it's really easy to develop your own driver as they provide you with good information about the internal controller states you have to complete/follow!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 12 of 36
(3,405 Views)

Gerd,

 

That's brilliant, very much a KISS solution. I did find myself changing back and forth between U8 and U16 for no particular rason here... If you can share your FHPP cluster (input/output) also that would be great. 

 

Thanks a bunch...

/søren

0 Kudos
Message 13 of 36
(3,393 Views)

Hi Sören,

 

here's an image of those clusters (inside a bigger cluster):

check.png

It's pretty much the information you find in the Festo programming manual!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 14 of 36
(3,390 Views)

Hi Soren,

 

First off apologies for the slow reply - some other duties meant I did not log into the forums for a while.

I think you may already have an excellent solution from Gerd and have already implemented it! However, if not, I attach some screen-shots from my code. I doubt it is as elegant but if you are going for the modbus commands here is what I did.

 

 

 

The obvious - this is the vi I am using for reading and writing - unput and output are U16 arrays.

VI_used.PNG

First of all FESTO provided me with this very nice 'cheat sheet' for FHPP commands which can save some time going through the manual! They also have their own modbus TCP client that they can provide to you - it is a good way of figuring out the commands to you need to get the motor running! All of my inputs in the first 3 bytes are false except for Brake, Stop, Enable, Halt, Start, Reset and Home. They are changed based on if you are starting, homing or stopping the drive.

 

FHPP_Cheat_sheet.PNG

 

 

So I'm just converting these bytes into u16 (probably badly and inefficiently ;-)).

 

The velocity is a percentage of the maximum you set using the Festo Configuration Tool - so hardwired into my vi is 20mm/s - this is why I divide by 20 and multiple by 100. Position is multipled by 1000 as this is the accuracy I set in the FTC factor group! (10-3) so 10.00mm is written as 10000

 

This is the code I use to configure the U16 input array!

Write.png

 

Write2.PNG

Above is what my front-panel looks like for the input conditions selected......also I think I'm using FHPP+ rather than FHPP which is the reason for elements 5-8 in the array. These are not needed (as far as I can recall) if you just go with FHPP control.

 

For parsing the data received back I used the following vi:

Read.png

And here is what the front panel looks like for a typical read of data

 

Read2.PNG

Hope this all helps,

Dave

 

 

0 Kudos
Message 15 of 36
(3,359 Views)

Hi,

i recently have to do the same as you and find the screenhot of very helpful on how to build the modbus words and how the extract the data of the response.

But what VIs do i have to use to create a connection to the drive and which VIs are used to write and read from the drive?

 

@GerdW: You wrote that you use "simple TCP messages". So just

TCP open connection

TCP Write (data in: string created via GerdWs example)

TCP Read (data out:string converted via GerdWs example

TCP Close connection

 

 

Thanks for your help

bet regards

0 Kudos
Message 16 of 36
(2,943 Views)

Hi One,

 

So just…

Yes.

Just those 4 basic TCP functions!

 

That's the "connect" state of the statemachine controlling one Festo unit:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
Message 17 of 36
(2,935 Views)

Thank you very much with this Help. Today I can control the basics parameter of my Festo Controller without problems.

I want to take more features under control and in the future, I will need to read and write Holding Register of Festo using Labview. I would like to control all the necessary driving´s PNU from my VI, such as Record Table, Group Factors, software and Hardware Limits, max. (and min.) Velocity, and max. (and min.) Acceleration.

There is someone who knows basically how to begin this Odyssey?

 

Thank everyone very much.

0 Kudos
Message 18 of 36
(2,761 Views)

Hi Nico,

 

how to begin this Odyssey?

Usually you begin your journey by reading the manual that came with your drive and drive controller!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 19 of 36
(2,757 Views)

Hey GerdW,

 

thank you for your tip, but I have read the manual more than a couple of times and I can´t find the answer in. I have no problems to control my FESTO motor with Modbus, but when I want to change parameters like "Factor Units" or "Maximal Velocity" with Labview, I don´t reach my goal. I can change this PNU parameter just using the FESTO software, but I can not see how to manage this PNU paramers with Labview wires.

Now a leave my current questions, in order to expose better my blurred lines and state of confusion:

Should I send 4 or 8 words? Should I send more bytes?
How operate FHPP+ with Labview and which Labview Modbus Function should I use to read/write PNU parameters?

 

I hope someone can help me!
Thanks everyone. I wish you all a great week!

 

 

0 Kudos
Message 20 of 36
(2,728 Views)