I want to call a routine if a digital output is low. I know you can use TestDI() to look at the state of a digital input. It would look as follows
IF TestDI(myDI) = FALSE myRoutine1;
This wont work for a digital output. I want to do something like this
IF myDO = 0 myRoutine1;
I am doing this on an IRC5 controller if this helps.
I have a path for my robot, its divided in 7 segments. Each segment is in a different PROC and when the PROC starts I use different virtual DOs to identify later which PROC was, and of course I reset it in the same PROC.
The main idea is that the robot its moving in auto NON stop, then suddenly stops, and the actual DO signal shows, as a “pointer” where is standing the robot and based on this, moves home automatically.
My code: IF DOutput (T1)=1 then …
elseif DO… then …
…
elseif DOutput(T7)=1 then…
ENDIF
I made a button in Screen maker which calls this “Comparation” PROC, I run it only in manual safe mode.
The problem is: The comparation is OK till the 2nd IF, after that the 4th is running but none of the last ones(3,5,6,7). Why?
I tried to divide all these 7 comparation in 3 main IF … instructions, but not resolved.
I realised, maybe the IF instr. cant handle more then 3 ELSEIF instructions, but No, not this is the problem. I have no idea and the time is passing but I cant move forward.
Are the signals T1 to T7 set correct before you start the IF part?
Did you set the signals after a Move-instruction with a zone? Then the signals do not match with the segment the robot just moved to.
Do you reset all signals before you start again?
Here is a part of my code:
Module1.mod file is working now with no problem, I changed to a Programmable button on TP, not TouchScreen button as you can see on Module2.mod file
But in case of the Module2.mod file, its not “getting in” the 3,5,6,7 step.
If you have time, please look at it, Id like to know whats wrong, to learn from it BUT, I solved already.
The positioning processor and the I/O processor are synchronized after the fine zone in Approach. The logical operation: Reset T1; Set T2; will be set correctly. But then the positioning process goes true the next operations very quickly to look at the movements in advanced. So Reset T2; will be done just after Set T2; and the signal is on for a very short time or might even never be on.
when the robot is moving and suddenly stops at one certain point (and this part of the program will be used in manual, safe mode), anyway one of the signals will be SET. Its quite sure that it will not stop on a RESET or SET point. But I resolved, I had to take out the "TPReadFk" section, because it seemed that to many IF instr. just cant be handeled, but of course I`ll try your suggestion and will see. Thanks for help anyway.