Omron Forums Support Posted September 16, 2011 Share Posted September 16, 2011 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 More sharing options...
dzrong Posted October 9, 2011 Share Posted October 9, 2011 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 More sharing options...
Omron Forums Support Posted October 10, 2011 Author Share Posted October 10, 2011 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 More sharing options...
kschuberg Posted March 24, 2015 Share Posted March 24, 2015 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 More sharing options...
linda618 Posted August 1, 2018 Share Posted August 1, 2018 hello,everyone When i use cfromscrip() function in scrip plc ,i put its result into P var, and it always nan,who could tell me the reason? Thanks Link to comment Share on other sites More sharing options...
steve.milici Posted August 2, 2018 Share Posted August 2, 2018 Please contact support@deltatau.com with your code and observed issues. Link to comment Share on other sites More sharing options...
Recommended Posts