Jump to content
OMRON Forums

Including C standard libraries in Power PMAC IDE project


Omar

Recommended Posts

Hello there,

I created an empty project on the Power PMAC IDE, and created a .c file and .h file inside the C Language/Realtime Routines folder. Here is what my file structure looks like

image.png.d612b704e9ae5eac8df3ef6b46127cff.png

Everything is just the default from creating an empty project, except the cappheader1.c and cappheader1.h files.

 

my cappheader1.h file looks like this:
 

#include "../Include/pp_proj.h"


#include <stdio.h>
#include <float.h>
#include <signal.h>

#include <stdlib.h>
#include <string.h>
#include <math.h>

 

and my cappheader1.c file looks like this:


#define _PPScriptMode_
#define _PP_PROJ_HDR_
#include "../Include/pp_proj.h"
#include "cappheader1.h"

 

When I build, I get this error:

image.thumb.png.02cd5a8b75d27587d61cebac13828b0c.png

And a similar error happens with string.h and math.h, depending on which is being included first, but not with stdio.h, float.h or signal.h. There might be other libraries that might or might not build in this scenario, but these are just the libraries I have tried.

 

Why does this error happen? And what do I do if I need to include those libraries in my project? 

 

Thanks in advance for your help!!

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Since usrcode runs in the real-time kernel, its efficiency requirements are very high.

Therefore the use of other external libraries is not allowed. This will affect the operation of the kernel. You can use these library functions in background Linux programs.

 

Link to comment
Share on other sites

Thank you so much MoMo, yes that works. But since I am trying to utilize custom servo routines, is there a way around that, by somehow utilizing C libraries, and simultaneously having files inside "Realtime Routines" folder (which I assume is the only way to utilize custom servo routines)?

 

Cheers

Link to comment
Share on other sites

You can create any custom servo routine adding a new function to usrcode files.

The error proof method would right click on Realtime Routines folder, then User Servo Setup.
There you can assign which function within the usrcode will be executed for each motor, and also create new functions.

In the IDE latest release there are a few option of exporting realtime routines, but I didn't explore that yet, so not sure if that could be useful somehow to what you are trying to achieve.



 

Link to comment
Share on other sites

On 8/28/2024 at 11:45 AM, Omar said:

Thank you so much MoMo, yes that works. But since I am trying to utilize custom servo routines, is there a way around that, by somehow utilizing C libraries, and simultaneously having files inside "Realtime Routines" folder (which I assume is the only way to utilize custom servo routines)?

 

Cheers

You can only use the mathematical function library currently provided internally by PMAC. As for the others, you cannot use them, or you have to write these functions yourself.

Generally speaking, a custom algorithm should be a very concise mathematical calculation program that does not contain any string processing or other content.

Your algorithm can be verified in advance using other tools, such as matlab, and then implemented in PPMAC.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...