george.kontogiorgos Posted January 17, 2022 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
Omron Forums Support Posted January 17, 2022 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
george.kontogiorgos Posted January 18, 2022 Author Posted January 18, 2022 Eric, I think that your suggestion fits on my application for now. Thanks. Quote
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.