Jump to content
OMRON Forums

Recommended Posts

Posted

Hello

 

I would like to know if there is a way to share variables (e.g. Global Variables) between PowerPMAC Script Language and embedded Linux on controller.

 

Actually, I was unsuccessfully trying to create a C program and compile it with GCC to access the content of a Global Variable address as the example as follows:

 

#include 
#include 

int main()
{
 int * pointer;

 pointer = 0xa9304b20;

 printf("%d\n", *pointer);

 return 0;
}

 

Where

 

Sys.P[100]=$a9304b20

 

The program crashed by Segmentation Fault error and I'm searching for new ways to access these variables on the memory by Linux.

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Posted

This would be very complicated if the program is compiled outside of the IDE.

 

This could be done easily with a background C Application ("C Language" -> "Background Programs" -> "capp1"). Just declare a gobal variable in script and use it as a double in C. Printf statements will be visible over SSH.

 

To call the program.

From IDE Terminal/GPASCII:
system /var/ftp/usrflash/Project/C\ Language/Background\ Programs/capp1.out
From Script PLCs/Motion Programs:
system "/var/ftp/usrflash/Project/C\ Language/Background\ Programs/capp1.out“

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...