TCON/TSEND/TRCV are indeed communication jobs, but there are different communication jobs.
TCON/TSEND/TRCV are used if you want to send/recv data every few seconds, or once a minute, or once a day. They are NOT used in cyclic IO-communication like profinet-IO.
-Make sure you have the GSD for the DFE32B installed.
-Add the Movidrive as a device in Portal's Network View. They are found in: Other field devices > PROFINET IO > Drives > SEW > SEW > DFE/DFS
-Your newly created SEW device has 03 Data words as default setup. Change this depending on the needs of the SEW program by double clicking on the SEW, deleting the 03 data words and selecting a new one from the right pane.
-Click and drag from the profinet port of the CPU to the profinet port of the newly created SEW-device.
NOTE: if you want to change the amount of data words used by the SEW after you've made the connection, Portal has the tendency to crash.
The connection between CPU and SEW has just been set-up. Default IO used is 256-261. This means you can address it in the program as %QB256 - %QB261 and %IB256 - %IB261. This can be changed if you want to.
Now it's time to get the SEW documentation, since the SEW decides what these words are used for. And this depends greatly on which program is being used in the SEW.
For most SEW applications the following is true:
%IW256: Statusword (depends on the SEW application used)
%IW258: Motor speed readout
%IW260: Motor position
%QW256: Controlword (depends on the SEW application used)
%QW258: Motor speed setpoint
%QW260: Target prosition
If you are using standard SEW built in applications, then you can just configure them and in the end, start the simulator to see which bits are used for what in the Status-/Controlwords.
The following us valid for SEW Application: Bus Positioning
Create a DB within your Portal program, name it "Drives" for example.
Create a struct called "SEW_RECV". (you can use any other name tbh)
Within this struct create:
- "Status" of type BYTE (this will display the value of the 7-segment display on the drive, 0,5,6,A,C, etc)
- 8 line of type BOOL (these are the status from the drive like motor turning, fault, limitswitch, etc)
Give these bools valid names depending on your SEW application
- "CurrentSpeed" as Int
- "CurrentPosition" as Int
Create a struct in the same DB called "SEW_SEND". (or any other valid name)
Within this struct create:
- 16 lines of BOOL. These are the various commands the drive needs to work. Such as Controller inhibit, start, stop, rapid stop, CW, CCW, jog+, jog-, reference run, etc
Give valid names depending on SEW Application
- "SpeedSetpoint" as Int
- "PositionSetpoint" as Int
At the start of your program, use SFC14 to read the data.
- LADDER is the 03 data words from the Drive configuration, Portal allows you to search for it, unlike Step 7.
- RET_VAL is the status of the SFC, use this to determine a no-read of the values and act accordingly.
- RECORD is the record/struct where the data should be placed after reading it. In the example given above, it should containt: "Drives".SEW_RECV
After the code for the drive, or at the end of your program, use SFC15 to write the data.
- LADDER is the same as SFC14
- RET_VAL has the same function
- RECORD should be: "Drives".SEW_SEND
As for coding, it's rather simple
Code:
// Controller inhibit
code...
code...
code...
= "Drives".SEW_SEND.Controller_Inhib
// Positioning
L "Some number"
T "Drives".SEW_SEND.PositionSetpoint
etc
etc
etc
The problem is however, if you are using custom built IPOS programs.