C Control The I Unit-M Advanced 5 Vdc Inputs / outputs 16 x digital I/Os / 8 x analogue or digital I/Os Program memory 2 198805 Datenbogen

Produktcode
198805
Seite von 42
 
MyWord=MyByte1 MOD MyByte2 
Syntax: Variable = value1 AND value2 
 
 Variable: Variable of Byte oder Word type  
 value1 Variable, value oder constant of Byte oder Word type  
 value2 Variable, value oder constant of Byte oder Word type 
 
 
Using ths operators with IF then, they behave like a function call that accepts two parametres and  
returns either True or False.   
IF (MyByte=1) OR (MyByte=2) THEN GOTO X 
 
 
 
 
 
 
PROGRAM FLOW CONTROL 
 
PAUSE 
Holds a program for a specified time 
PAUSE is the simplest instruction for flow control. It stets the program for a cerain time on hold. While a 
pause is active, system interrupts (e.g. System Timer) are still executed, but the user interrupt INTERRUPT 
is executed after pause has ended. The Pause value is 20ms units, i.e PAUSE 50 will cause a 1 second 
pause. 
 
Syntax: PAUSE = value1 
PAUSE 25 
Value1: Variable, value oder constant of  
             Byte oder Word type.   
 
 
 
FOR, TO,  NEXT,  STEP, EXIT FOR 
FOR TO NEXT repeats a group of statements a specified number of times.  
 
Once the loop starts and all statements in the loop have executed, step is added to counter. At this point, 
either the statements in the loop execute again (based on the same test that caused the loop to execute 
initially), or the loop is exited and execution continues with the statement following the NEXT statement.  
The step argument can be either positive or negative. Other as usual the loop is exited at a exact match of 
Counter and End only. EXIT FOR will cause an early exit. 
You can nest FOR NEXT loops by placing one FOR NEXT loop within another. Give each loop a unique 
variable name as its counter.  
 
 
FOR MyWord=MyStart TO MyEND STEP  MyStep 
PRINT MyWord 
IF MyPort=OFF THEN EXIT FOR 
NEXT MyWord 
 
 
 
 
 
 
 
Syntax: For [Counter] = [Start] To [End] [Step [Incr]] 
             [Exit For] 
             Next  
 
Counter:  Variable used as counter.  
Start:       Variable, value or constant which is moved to the counter variable as start condition.  
End:         Variable, value or constant, the counter variable is compared with.  
Incr:          Required if STEP is used. Term, variable, value or constant defining the increment.  
DO, LOOP UNTIL, EXIT DO 
Repeats a block of statements while a condition is True or until a condition becomes True.  
 
 
19