Internet PLC Forum
General => Technical support => Topic started by: can on May 02, 2011, 10:45:28 AM
-
Hi. If I need to control a motor based on adc(1), how can I get a responsive control? eg, if adc(1) > 15, setdac 1,500. However, when adc(1) < 15, setdac 1,0. It has to do this while looking out for changes from adc(1) until an interupt is activated. Do I use a while loop? thank you.
-
You can use the {CusFn} form (non-differentiated) of the custom function so that this custom function that monitors the ADC can be executed every scan of the ladder program. This way your program will still be running other parts and not get locked up into only the while loop that monitors the ADC.
-
Hi. If I put an interlock for this process, will the response time be better? When this process is run, all other steps are ignored until this process is completed. Thanks.
-
If your system can tolerate the program being stuck inside a while loop to monitor the ADC then you can use a while loop to continuously monitor the ADC as you have intended. You should have a way to break it out using interrupt (e.g. ISR can change a variable so that the while loop will break if the variable is changed to a certain value.