Jump to content
OMRON Forums

Accessing user shared memory from C


Sina.Sattari
 Share

Recommended Posts

[b]Question:[/b] How do I access Sys.Fdata memory from a bgcplc? What I specifically need to do is to read in data from an array in Sys.fdata memory. I don't want to declare pointers to every block in the array, just to increment a pointer. [b]Answer:[/b] Here is how to do it: (be careful if you decide to use double, since it is 64bit and it will use up the user shared memory in batches of 2 32bit locations at a time) [code] #include #include #include void user_plcc() { float *myfloat; myfloat = (float*)pushm; // setting the address from void pointer pushm casted as float pointer *myfloat=5.5; // equivalent of sys.fdata[0] – you can also write it as myfloat[0]=5.5; myfloat[3]=3.141592; // equivalent of sys.fdata[3] } [/code]
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...