Jump to content
OMRON Forums

Using CfromScript() - Calling C Functions from the PMAC Script Language


Omron Forums Support

Recommended Posts

Attached is a new document describing how to use CfromScript() in Power PMAC, which is a function that permits users to call C functions directly from PMAC Script programs, such as PLCs and Kinematics Subroutines.

 

CfromScript() can be used for general purpose calculations, but CfromScript() is useful primarily for performing kinematics calculations, because to perform these calculations in a compiled C program is significantly faster than to calculate them using the interpreted PMAC Script kinematics subroutines. This is especially useful for highly nonlinear, computationally-intensive calculations, such as that which occurs in Hexapod or Delta Robot kinematics. Another advantage is that with CfromScript(), the user can more easily implement common C-based nonlinear iterative solvers, such as those given in the famous Numerical Recipes in C cookbook.

 

If you have any questions on the usage or implementation of this function, please feel free to post them.

Using CfromScript in Power PMAC.pdf

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

I know what's the meaning of the L,C and D datas.The documens tells us that:

//#define KinPosMotor1 L1

//#define KinPosMotor2 L2

//#define KinPosAxisX C6

//#define KinPosAxisY C7

//#define KinAxisUsed D0

But what is the meaning of R data,especially in CfromScript,and how to use it?

 

Thanks

Link to comment
Share on other sites

R variables, according to page 6 of the Power PMAC Computational Features manual, are:

 

"Stack/return (“R”) variables: local user variables for passing and returning arguments to subroutines and subprograms; equivalent to differently numbered L-variables."

 

You will not actually need R-Variables for your kinematics subroutines in CfromScript since you can just use whatever variables the C programming language offers for passing parameters between functions. You probably will not need to access these in CfromScript, since they are normally only used in Script-based subprograms and subroutines, but we permit access to R-Variables in C just in case you do need it.

Link to comment
Share on other sites

  • 3 years later...

Charles,

 

I was hoping you could provide a small example of how to implement C functions in the realtime routine for specifically kinematics. Does the C application need to be called in the realtime PLC to use with kinematics? I have a two motor kinematic equation (motor 1-X and motor 2-Y) that has a fairly simple equation. We are hoping to see the performance gains of moving the kinematic calculations to the C realtime routines.

 

Thanks!

Link to comment
Share on other sites

  • 3 years later...
Guest
This topic is now closed to further replies.

×
×
  • Create New...