mooseical Posted November 19, 2014 Posted November 19, 2014 . I read through old threads and a lot of it was very helpful, I am not as savvy as most, so the more details the better :) I have my incoming data to a A28E address on turbo PMAC2 UMAC M162->Y:$78c00,8,16,u (is this my Gather source?) I5000=0 i5001=$078c00 (Y register (source is 78c00?)) i5050=$1 i5049=100000 M1000->X:$003120,0,24 ; thinking that I would see values from the gather M1001->Y:$003120,0,24 ;BTW: the only value that shows up for both is 67584 and it does not change ; my attempt at wrighting a PLC that would look at the M162 and log the data when the value is greater than 300 counts and stop logging then less than 300. I have later intent to graph the data. but first I am just trying to see some values in the watch window. CLOSE DELETE GATHER DELETE TRACE I5049=100000 i5001=$c78c00 i5050=$1 i5000=0 DEF GATH 4000 OPEN plc 1 CLEAR if (m162>300) GATHER ELSE Endgather endif close Thank you
mooseical Posted November 19, 2014 Author Posted November 19, 2014 . I read through old threads and a lot of it was very helpful, I am not as savvy as most, so the more details the better :) I have my incoming data to a A28E address on turbo PMAC2 UMAC M162->Y:$78c00,8,16,u (is this my Gather source?) I5000=0 i5001=$078c00 (Y register (source is 78c00?)) i5050=$1 i5049=100000 M1000->X:$003120,0,24 ; thinking that I would see values from the gather M1001->Y:$003120,0,24 ;BTW: the only value that shows up for both is 67584 and it does not change ; my attempt at wrighting a PLC that would look at the M162 and log the data when the value is greater than 300 counts and stop logging then less than 300. I have later intent to graph the data. but first I am just trying to see some values in the watch window. CLOSE DELETE GATHER DELETE TRACE I5049=100000 i5001=$c78c00 i5050=$1 i5000=0 DEF GATH 4000 OPEN plc 1 CLEAR if (m162>300) GATHER ELSE Endgather endif close Thank you
steve.milici Posted November 20, 2014 Posted November 20, 2014 This will do what you want but I5001 should be $78C00 as you only need the Y register. Also the correct syntax for defining the gather buffer is “DEF GAT 4000” or “DEFINE GATHER 4000”.
steve.milici Posted November 20, 2014 Posted November 20, 2014 This will do what you want but I5001 should be $78C00 as you only need the Y register. Also the correct syntax for defining the gather buffer is “DEF GAT 4000” or “DEFINE GATHER 4000”.
mooseical Posted November 23, 2014 Author Posted November 23, 2014 Thank you very much for your response. unfortunately it doesn't seem to work. When I save and upload the PLC and enable it, my values for M1000 and m1001 do not change, they both always display the same number: 67584. also when I list the PLC in the command terminal, the "gather, def gat, endgather" terms do not show up. are these allowed in PLC's? how can I see the data in the gather buffer? Thanks This will do what you want but I5001 should be $78C00 as you only need the Y register. Also the correct syntax for defining the gather buffer is “DEF GAT 4000” or “DEFINE GATHER 4000”.
mooseical Posted November 23, 2014 Author Posted November 23, 2014 Thank you very much for your response. unfortunately it doesn't seem to work. When I save and upload the PLC and enable it, my values for M1000 and m1001 do not change, they both always display the same number: 67584. also when I list the PLC in the command terminal, the "gather, def gat, endgather" terms do not show up. are these allowed in PLC's? how can I see the data in the gather buffer? Thanks This will do what you want but I5001 should be $78C00 as you only need the Y register. Also the correct syntax for defining the gather buffer is “DEF GAT 4000” or “DEFINE GATHER 4000”.
steve.milici Posted November 24, 2014 Posted November 24, 2014 I missed the “Endgather” statement you have – take that out it is not needed if you set I5049 to zero for a simpler structure for a one-shot gather. Also place a timer in the PLC to slow down the scan rate of the PLC as the one-shot gather statement may be executed at a very high rate when the condition is true: CLOSE DELETE GATHER DELETE TRACE I5049=0 I5001=$78c00 I5050=$1 I5000=0 DEF GAT 4000 OPEN PLC1 CLEAR IF (M162>300) GATHER I5111 = 100 //adjust this for the rate you want in //servo cycles or x(I10/8,388,608) in ms. //as in I5111 = 1000*(I10/8388608) for 1 sec WHILE (I5111>0) ENDWHILE ENDIF CLOSE Also you probably want to add some condition to end the PLC at some point unless you intend to disable the PLC externally.
steve.milici Posted November 24, 2014 Posted November 24, 2014 I missed the “Endgather” statement you have – take that out it is not needed if you set I5049 to zero for a simpler structure for a one-shot gather. Also place a timer in the PLC to slow down the scan rate of the PLC as the one-shot gather statement may be executed at a very high rate when the condition is true: CLOSE DELETE GATHER DELETE TRACE I5049=0 I5001=$78c00 I5050=$1 I5000=0 DEF GAT 4000 OPEN PLC1 CLEAR IF (M162>300) GATHER I5111 = 100 //adjust this for the rate you want in //servo cycles or x(I10/8,388,608) in ms. //as in I5111 = 1000*(I10/8388608) for 1 sec WHILE (I5111>0) ENDWHILE ENDIF CLOSE Also you probably want to add some condition to end the PLC at some point unless you intend to disable the PLC externally.
steve.milici Posted November 24, 2014 Posted November 24, 2014 Also note that the value in M1000 is the address pointer to the beginning of gathered data. M1001 is the next location to be gathered - the running pointer. The decimal value of 67584 would be the PMAC buffer address in HEX of $10800. This would be the end of memory for an OPT-5C0 CPU which might indicate the gather has reached the end of memory. The LIST GATHER command will cause PMAC to list all data in the gather buffer.
steve.milici Posted November 24, 2014 Posted November 24, 2014 Also note that the value in M1000 is the address pointer to the beginning of gathered data. M1001 is the next location to be gathered - the running pointer. The decimal value of 67584 would be the PMAC buffer address in HEX of $10800. This would be the end of memory for an OPT-5C0 CPU which might indicate the gather has reached the end of memory. The LIST GATHER command will cause PMAC to list all data in the gather buffer.
Recommended Posts