Junji Posted May 11, 2010 Share Posted May 11, 2010 Could you give me an example how to use indirect addressing technique? Our customer wants to run a motor along commanded position data computed by C-PLC program on shared memory user buffer. I guess User servo can copy the data to commanded position register every servo cycle. Link to comment Share on other sites More sharing options...
bradp Posted May 11, 2010 Share Posted May 11, 2010 You should not need to use indirect addressing since we have data predefined structures to access the user buffer. To access the user buffer from the Cplc or Capp follow the examples in this post http://forums.deltatau.com/showthread.php?tid=17&highlight=user+buffer the better example are towards the last listings. From the PPmac either in script programs or the terminal you can use the structure Sys.ddata[n]. To increment through it just use a local variable for the index. open plc 1 local myIndex; local myVar; myIndex = 0; while(myIndex < 10){ myVar = Sys.Ddata[myIndex]; myIndex++; } close For a few more details take a look at the attached traing excerpt. Link to comment Share on other sites More sharing options...
Junji Posted May 12, 2010 Author Share Posted May 12, 2010 So the maximum value of myIndex would be 131071 when shared memory user buffer size is 1MByte default. Is my understanding correct? Link to comment Share on other sites More sharing options...
bradp Posted May 12, 2010 Share Posted May 12, 2010 Correct. Test it in the IDE. If you go above the highest index PPmac returns nan. Link to comment Share on other sites More sharing options...
Recommended Posts