Browse FAQs

How to generate a PTO (pulse train output) using a M241 controller with SoMachine?

Published date: 19 November 2018

This is a step by step procedure on how to write a small program in SoMachine to generate a PTO (pulse train output) using a M241 controller

Product Line:
M241 controllers

SoMachine v4.3

To have a starting project that will help a customer generate a PTO (pulse train output) with a M241 controller

1. Start a new project in SoMachine and select a M241 controller
2. Go to the Logic Builer. Go to View / Clasic Navigators / Devices. This will open a window called Devices.
3. In the Devices window double-click on Pulse_Generators. This will open a window called Pulse_Generators.
4. In the Pulse_Generators window select a Pulse generation function by clicking on the Value field. Select PTO and hit Enter
5. Select the Output Mode. You have four options. For this resolution we will select Quadrature
6. Select the outputs to be used by selecting a Fast output in the "A output location" and "B output location"
7. The Instance Name is the name that will be used by the input pin "Axis" of the MC_xxxx_PTO function blocks. You can leave the defalut PTO_0 or change it
8. Create a POU and add it to the Mast task. To create a POU go to Devices window / right click on Application / Add object / POU. Select  CFC for this example, any other implementation language can be used. To add the POU to the MAST task just drag it there
9. Double-click on the new POU. From the Toolbox window select "Box" and then click in the POU window.
10. We will create the following function blocks: MC_Power_PTO, MC_Stop_PTO, MC_ReadActualPosition_PTO, MC_MoveRelative_PTO, MC_MoveVelocity_PTO. Other function blocks can be used
11. For the Axis pin we will type in PTO_0 or if you change the Instance name from step 7, used the new name.
12. Build your project and download it to your controller. Tu build it go to Build / Build. To download go to Online / Multiple Download / Always perform a full download. This will update the boot application and download the project to the RAM. Connect to your controller by going to Online / Login.
13. To enable MC_Power_PTO function block, pin Enable and DriveReady have to be TRUE. You can create variables that you can turn ON or you can type the word TRUE instead of a variable
14. We can generate an unlimited pulse train output with a fixed frequency by using the MC_MoveVelocity_PTO. You will need to have values entered at least for Velocity, Acceleration, Deceleration and Direction
14. By turning the Execute bit ON of the MC_MoveVelocity_PTO function block, the M241 will generate a PTO with a fequency equal with the Velocity value.
15. To stop the pulses execute a MC_Stop_PTO
16. You can generate a finite number of pulses by executing the MC_MoveRelative_PTO. You will have to have values entered at least for Distance, Velocity, Acceleration, Deceleration. After that you will have to turn the Execute bit ON.

This completes the step by step procedure on how to write a small program in SoMachine to generate a PTO (pulse train output) using a M241 controller


Was this helpful?

What can we do to improve the information ?

Can't find what you are looking for?

Reach out to our customer care team to receive information on technical support, assistance for complaints and more.