Search the Community
Showing results for tags 'wait'.
Found 2 results
tiltacion posted a topic in CX-ProgrammerHi, I'm quite new to the PLC programming, I saw this delay input in one of the videos, that automatically switched to 1 after a set time, it wasn't a timer, just an contact input with time delay
Red Lion C programing - Wait? RESOLVED
lamboom posted a topic in HMI & SCADAAnyone ever used a Wait-for digital tag in a C Program? I have to use C in the Red Lion Programs.. but, I'm not at all proficient in C (or anything else for that matter ..) Here’s a nice problem for basic C programming .. I really need to solve it .. but, so far ... can't ... sigh!: I have an actuator that will be commanded to make sine wave motion. The program that does that, in the actuator’s driver-controller, requires the actuator to first be in a zero position. Homing has already been done, so the drive knows where the actuator is. I cannot modify the sine wave program; but, can command a Move Absolute program in the drive, to take the actuator to zero, if it isn’t already there. When the actuator is at zero, it is “In position” and a digital tag will go True. If the Tag is False, the actuator is not at zero, it’s at some other position, and only the Move Absolute program can return the actuator to zero. So, when launching this position command program, In a Red Lion G3 HMI, using only Basic C programming, how would you write a control program that would test the status of the actuator’s position, and, finding it at zero (the “InPos” tag is true) would start the Sine Wave program. And, If the “InPos” Tag is false, would start the Move Absolute program, which would return the actuator to zero, and when the actuator is In Position, would start the Sine Wave program. Here’s the tricky part. It will take only a few milliseconds to start the Move Absolute program (if required) .. but how do you get the “C” control program you are writing, to wait until the actuator actually reaches zero, and the “inPos” tag goes true … which could take several seconds? I don’t believe there is a WaitFor function in “C” , and you cannot send either the Move Absolute, or the Sine Wave program more than once .. so, if a loop is used, it can loop only one time .. presumably with conditional delays. (however that's done) You cannot use Sleep().. that would be cheating.. the full program must run in the least amount of time, and you do not know how far the actuator is from zero. You could use if (! InPos) or if (InPos) to qualify what programs to run .. but, where does the “Wait for In position” fit into C Programming? You might be able to use Continue .. but, ya still have to wait for “InPos” to go True…..before running the Sine Wave. Thanks Much, Regards, Michael