dzrong Posted May 23, 2014 Share Posted May 23, 2014 Hello,Everyone I'm setting a ACC65E in a UMAC MACRO STATION,and the base address of it is $A800,so I have to init the control words in a plc, you can see the code here: Open PLC 1 Clear I5111 = 2500 * 8388608 / I10 WHILE (I5111 > 0) EndW cmd"MS0,MI198=$40A807";set control word for Acc-65E CMD"MS0,MI199=$07" ; I5111 = 250 * 8388608 / I10 WHILE (I5111 > 0) EndW Disable PLC1 Close But ,what I want to know is why the MI199 is still 0 when the power is on,of couser I had saved all the code and the PLC,and $7 is what we want.But the value of MI198 is right,so the plc1 had run,and the cmd had sent to,but what's the possble reason? Link to comment Share on other sites More sharing options...
Sina.Sattari Posted May 23, 2014 Share Posted May 23, 2014 I would suggest two solutions: 1. Add a delay between the two CMD"" commands in the PLC. This will allow the process to jump out of the PLC, execute the command buffer (the first command) and then get back into the PLC and put the next command in the buffer which will be executed on the next scan of the command buffer. 2. Use MACROSLVWRITE or MSW command directly in the PLC rather than using a CMD"". This will allow you to avoid having to include timers and loops. The only drawback is that you need to set the values into a PMAC variable first and then write it to Macro. For example: Open PLC 1 Clear I5111 = 2500 * 8388608 / I10 WHILE (I5111 > 0) EndW P1=$40A807 MSW0,MI198,P1 P1=$07 MSW0,MI199,P1 Disable PLC1 Close Link to comment Share on other sites More sharing options...
dzrong Posted May 23, 2014 Author Share Posted May 23, 2014 The second solution is exactly what I want. Thank you very much! Link to comment Share on other sites More sharing options...
Recommended Posts