Hi,
I'm using two loops running in parallel to make the regulation of a voltage through the automatic control of a motor. In the first loop I read all the time which is the value of my actual voltage. There's also a subVI inside this loop that looks if the voltage is within the specified limits and if not, calculate in which direction and which is the optimal speed of the motor to continue regulating in order to achieve the desirable value. The actual voltage, the direction of the motor and the actual speed are stored in a global variable.
On the other side I have a loop with a machine state that at the beginning initializes my motor (I control it with serial communication) and it's reading the direction and speed glob
als and sending this information always to the motor until the first loop detect that our regulation has finished, and the machine state of the second loop stops the motor, and close the serial port.
In both loops I have a Wait(ms) command, 250ms in the first one (every voltage acquisition needs about 210ms) and 100ms in the second one (I just wrote this times without no idea, just to try them).
The thing is that this program is working most of the time perfect, BUT for some reason from time to time the subVI get hanged and I have to kill LV. I don't know if my problem comes from the timing in the loops or maybe because in some cases I'm writing and reading to one of the globals at the same time and I get a collapse. Could somebody help me? If I need some kind of semaphores or syncronization issues, could you send me an example? I'm using LabVIEW 7.0.
Thanks in advance,
Angel