Professional Documents
Culture Documents
Curso Sysmac - Ladder
Curso Sysmac - Ladder
Programming
infoPLC.net
Automation Systems
Basic
Ladder Rules
Automation Systems
Ladder Rules: Fundamentals…
Automation Systems
Ladder Rules: NO, we can’t…
Automation Systems
Ladder Rules: NO, we can’t…
•Only a COIL can be sereialized after a COIL
Automation Systems
Ladder Rules: YES we can…
Automation Systems
Contacts , Coils and
Sequence Instructions
Automation Systems
Contacts, Coils and Sequence Instructions
Coil
Diff UP Contact
Automation Systems
Contacts, Coils and Sequence Instructions
R_TRIG, F_TRIG and Differenciation
•IEC611313 defines R_TRIG and F_TRIG functions for the
Rising/Falling Edge detection
•NJ Series supports OMRON’s traditional Diff up/down and R_TRIG
(Up) and F_TRIG (Down)
Instance is needed !
Automation Systems
Contacts, Coils and Sequence Instructions
Automation Systems
Contacts, Coils and Sequence Instructions
SR and RS : Set
•Functions are used to SET and RESET the Keep Bit
•SR: Gives Priority to the Set Input when Set and Reset both are TRUE
•RS: Gives Priority to the Reset Input when Set and Reset both are TRUE
Automation Systems
Contacts, Coils and Sequence Instructions
SetBits/ResetBits
•Declaring “In” as a BitString.
• SetBits: Sets “n” bits to TRUE from bit number “Pos” in the BitString.
• ResetBits: Sets “n” bits to FALSE from bit number “Pos” in the BitString
Automation Systems
Contacts, Coils and Sequence Instructions
SetABit/ResetABit
•Declaring “In” as a BitString.
• SetABit: Sets TRUE bit in position “Pos” in the BitString.
• ResetABit: Sets FALSE bit in position “Pos” in the BitString
Automation Systems
Contacts, Coils and Sequence Instructions
OutABit
•Declaring “In” as a BitString.
• OutABit sets TRUE or FALSE the bit in position POS depending on the
value of BitVal
(TRUE)
Automation Systems
Timers
Automation Systems
Timers
Automation Systems
Timers
Instance_name
FB_Type
BOOL BOOL
TIME TIME
T#10ms
In
Q
PreTime
Elap
Automation Systems
Timers
•Timer Output (Q) is TRUE when (In) is TRUE and after (In) turns to
FALSE and ElapTime does not reach PreTime
T#10ms
In
Q
PreTime
Elap
Automation Systems
Timers
TP (Pulse Timer)
•Timer Output (Q) is TRUE with (In) Rising Edge
•Timer Output (Q) goes FALSE when ElapTime reaches PreTime
T#10ms
In
Q
PreTime
Elap
Automation Systems
Timers: Timer (Hundred ms Timer)
Automation Systems
Timers
In
PT
ET
Q
Even when Input is FALSE
Reset
Acumulated time is retained
Automation Systems
Counters
Automation Systems
Counters
CTU: Counter Up
CU
Reset
CtVal
Automation Systems
Counters
CD
LD
CtVal
Automation Systems
Counters
CU
CD
CtVal
QU
QD
Reset
LD
Automation Systems
Counters
Counter Variations:
•NJ includes variations of CTU, CTD and CTUD
•Different Datatypes can be used
DINT
CTU
LINT
CTD _
UDINT
CTUD
ULINT
Example:
Automation Systems
Math Instructions
Automation Systems
Math Instructions
TRIGONOMETRIC
RadToDeg and DegToRad
SIN, COS, and TAN
ASIN, ACOS, and ATAN
Automation Systems
Math Instructions
BASIC ARITHMETIC
•Basic Arithmetic functions operate with ANY_ELEMENTARY Data types
•NJ will automatically perform any necessary Datatype conversion.
BASIC ARITMETIC
ADD (+) MulOU (*OU)
AddOU DIV (/)
(+OU)
MOD
SUB ()
ABS
SubOU (OU)
Inc and Dec
MUL (*)
Example (ADD):
Automation Systems
Math Instructions
BASIC ARITHMETIC
BASIC ARITMETIC
ADD (+) : Addition
AddOU (+OU): Addition with OVEFLOW BIT
SUB (-): Substraction
SubOU (-OU): Substraction with NEGATIVE OVERFLOW BIT
MUL (*): Multiply
MulOU (*OU): Multiply with OVERFLOW BIT
DIV (/): Division
MOD: Modulo
ABS: Absolute Value
Inc* and Dec*: INTEGER Increment ++, and Decrement --
Automation Systems
Math Instructions
TRIGONOMETRIC
Automation Systems
Math Instructions
*Returns a BOOL
Automation Systems
Math Instructions
ST or Ladder?
No need to create FB in ST to be
instanced in Ladder, you can type
directy ST by using InlineST Function.
Automation Systems
Math Instructions: Ladder or ST ?
BASIC ARITHMETIC
Example of
Sum using ST
in Ladder
Automation Systems
Bit String Processing
Automation Systems
Bit String Processing
AND OR
Automation Systems
Bit String Processing
XOR XORN
Automation Systems
Bit String Processing
EXAMPLE
B1 1 0 1
B2 0 1 1
Result 0 0 1
Automation Systems
Bit String Processing
In1
L
L Out
In2
L
In3
L
In4
L
In5
L= Logic Operation
Automation Systems
Bit String Processing
NOT
The NOT instruction reverses the value of a Boolean
variable or the individual bits in a bit string
0 0 1 0 0 0 1 1
1 1 0 1 1 1 0 0
Automation Systems
Bit String Processing
Automation Systems
Bit String Processing
Example:
12 OR 2 14
17 OR 4 21
A[..] OR B[..] C[..]
Automation Systems
Comparison Instructions
Automation Systems
Comparison
Automation Systems
Comparison
Automation Systems
Comparison
Cmp
Automation Systems
Comparison
ZoneCmp
ZoneCmp: Outputs True when condition :
MN<=In<=MX
Automation Systems
Comparison
TableCmp
•Tablemp performs a Zone Comparison of tabular data
•Tabular Data TABLE is defined in 2 dimension Array
•Output Data is set in 1 dimension Array
Automation Systems
Comparison
Automation Systems
Comparison
13 EQ 13 True
Automation Systems
Comparison
Automation Systems
Comparison
A[..] EQ Bool
7 EQ False
13
13 EQ True
Automation Systems
Data Transfer
Automation Systems
Data Transfer
•MOVE •AryExchange
•MoveBit •AryMove
•MoveDigit •Clear
•TransBits •Copy**ToNum
•MemCopy •Copy**To**
•SetBlock •CopyNumTo**
•ExChange
Automation Systems
Data Transfer
MOVE
•MOVE command can copy value from the In parameter to the Out
parameter.
•Element of Array, Structure and Union can also be used
Automation Systems
Data Transfer
MoveBit
•MOVEBit command can copy the bit (InPos) from BitString In to the bit
(InOutPos) of the BitString InOut
InPos
Example: 5 4 3 2 1 0
In(34) 1 0 0 0 1 0
5 4 3 2 1 0
InOut(8) 0 0 1 0 0 0
InOutPos
Automation Systems
Data Transfer
MoveDigit
•MOVEDigit command copies one or more (Size) Digits, Starting in (InPos)
digit from BitString In to the digit position (InOutPos) of the BitString InOut
InPos
Example:
3 2 1 0
In 1 2 3 4
3 2 1 0
InOut 2 3 0 0
InOutPos
Automation Systems
Data Transfer
TransBits
•TransBits command copies one or more (Size) Bits, Starting in (InPos)
digit from BitString In to the Bit position (InOutPos) of the BitString InOut
InPos
Example: In
7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1
InOut
7 6 5 4 3 2 1 0
0 0 0 1 1 1 0 0
InOutPos
Automation Systems
Data Transfer
MemCopy
•MemCopy command copies two or more (Size) Array Elements From (In)
to (AryOut).
Example: Size=3
In[ ]
6 5 4 3 2 1 0
700 600 500 400 300 200 100
AryOut[ ]
6 5 4 3 2 1 0
0 0 300 200 100 0 0
Automation Systems
Data Transfer
SetBlock
•SetBlock Fills (Size) elements of (In) Array with (In) Value.
Example:
In
100
AryOut[ ]
6 5 4 3 2 1 0
0 0 100 100 100 0 0
Size=3
Automation Systems
Data Transfer
Exchange
•Values in InOut1 and InOut2 are exchanged
Automation Systems
Data Transfer
AryXChange
•Values in Arrays InOut1 and InOut2 are exchanged
Automation Systems
Data Transfer
AryMove
•MemCopy command copies two or more (Size) Array Elements From (In)
to (AryOut).
•In and AryOut can be different Datatypes
•When Datatype is same, MemCopy works faster.
Size=3
In[ ]
6 5 4 3 2 1 0
700 600 500 400 300 200 100
AryOut[ ]
6 5 4 3 2 1 0
0 0 300 200 100 0 0
Automation Systems
Data Transfer
Clear operation
Automation Systems
Data Transfer
Copy**To**
•The Family of Functions Copy**To** perform a BIT level copy
WORD
7 6 5 4 3 2 1 0
… 0 0 0 0 0 1 1 1
INT 7 6 5 4 3 2 1 0
… 0 0 0 0 0 1 1 1
LREAL … 0 0 0 0 0 1 1 1
Automation Systems