Hello Guest it is May 07, 2021, 07:17:33 PM

Author Topic: plc vs screenload script programming  (Read 732 times)

0 Members and 1 Guest are viewing this topic.

plc vs screenload script programming
« on: April 04, 2018, 09:22:03 AM »
I am collecting 4 analog input voltages with programming in the PLC script.  Each sweep of the PLC reads the analog voltage and it displays on a meter.   

I would like to turn on recording to collect these values for 5 seconds. 

 I am thinking of a global variable startrecording = "on" could be set with the down script of a button on the screen.  Then the PLC script would be checking for the "on" state of that variable and begin building an array with the voltages for 5 seconds when "on". Then after 5 seconds, the PLC script would change the startrecording to "off". 

Now I would have the array ready to write to a file.  Is there a problem doing this all in the PLC script?  Should I put the file operations in the script of a button on the screen?  Can I pick up the array as a global variable from that button or should I create a function to pass the array?  Not sure just how to sort through all the possibilities to decide what is the best method.  It does not seem like a good idea to potentially slow down the PLC script doing file operations.

Re: plc vs screenload script programming
« Reply #1 on: April 05, 2018, 03:06:03 PM »
I would start by setting up a timer as in Daz's video:


Have an on-screen button which will open a file to record the data, start the timer and set a 'ToRecord' flag.
In the PLC script write the values to the file if the ToRecord flag is set.
At the expiry of the timer close the file and stop the timer so it doesn't retrigger.

My wife left with my best friend...
     and I miss him!