Internet PLC Forum

General => Technical support => Topic started by: can on May 02, 2011, 10:45:28 AM

Title: analogue input control analogue output
Post 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.
Title: Re:analogue input control analogue output
Post by: support on May 02, 2011, 11:05:17 AM
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.
Title: Re:analogue input control analogue output
Post by: can on May 02, 2011, 11:10:27 AM
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.

Title: Re:analogue input control analogue output
Post by: support on May 02, 2011, 03:05:37 PM
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.