Posted 19 Jun 2008 Hello, is it possible use pointer in a task programmed with st language? I tried to write this: <SYMBOL> DM_0 CHANNEL D0 0 DM_1 CHANNEL D1 0 </SYMBOL> <CODE> DM_0 := 10; DM_1 := @DM_0; </CODE> I was expecting that @DM_0 was a pointer to D10, but in DM_1 i found the value of DM_0. Any help? Thanks Share this post Link to post Share on other sites
Posted 19 Jun 2008 I am no expert at ST but it appears that you have a space between D1 and 0. I suspect the space need s go and the number become D10. Share this post Link to post Share on other sites
Posted 19 Jun 2008 Hello drei, This will not work, the @ symbol does not work in ST the same as it does in Ladder. What you will need to do is set D0 as an array, and use an INT variable (i.e. MyIndex) as your pointer. value. MyPointer := 10 ; E.g. DM_1 := DM_0[MyPointer]; This will set D1 to the value that is in D10 Share this post Link to post Share on other sites
Posted 19 Jun 2008 (edited) It's exactly what i was looking for! Thank you very much Edited 19 Jun 2008 by drei Share this post Link to post Share on other sites
Posted 20 Jun 2008 I will also note, that the use of the [] brackets is common for addressing pointers in other platforms. Share this post Link to post Share on other sites