george.kontogiorgos Posted January 17, 2022 Share Posted January 17, 2022 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. Quote Link to comment Share on other sites More sharing options...
Eric Hotchkiss Posted January 17, 2022 Share Posted January 17, 2022 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“ Quote Link to comment Share on other sites More sharing options...
george.kontogiorgos Posted January 18, 2022 Author Share Posted January 18, 2022 Eric, I think that your suggestion fits on my application for now. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.