====== Starting Ladder Logic ======
Cubloc executes BASIC first. To enable Ladder Logic, use the command Set
Ladder On. After this command is executed, Ladder Logic will begin
running and perform ladder scans every 10 milliseconds.
If the Set Ladder On command is not used, Ladder Logic will not run and
no ladder scans will be performed
Set Ladder On
===== Using Ladder Logic Only =====
If only using Ladder Logic a minimal amount of BASIC code is required. The
BASIC code must contain, at a minimum, a device declaration, the Set
Ladder On command, and a Do...Loop to keep the program executing.
Port declarations, and aliases must also be declared in BASIC.
The following example illustrates such a program.
Const Device = CB280 'Device Declaration
UsePin 0,In,START 'Port Declaration
UsePin 1,In,RESETKEY
UsePin 2,In,BKEY
UsePin 3,Out,MOTOR
Alias M0=RELAYSTATE 'Aliases
Alias M1=MAINSTATE
Set Ladder On 'Start Ladder
Do
Loop 'BASIC program will run in infinite loop.
===== Ladder Symbols =====
==== Contact A, Contact B ====
Contact A is "Normally Open" and closes when a signal is received. On the
other hand, Contact B is "Normally Closed" and opens when a signal is
received.
{{ :cubloc:starting_ladder_logic:contact.png?nolink |}}
==== Input, Output Register Symbol ====
Input/Output registers are the most basic symbols among the registers in
Ladder Logic.
{{ :cubloc:starting_ladder_logic:ladder1.png?nolink |}}
==== Function ====
Function include timers, counters, and other mathematical
operation registers.
{{ :cubloc:starting_ladder_logic:functionrelay.png?nolink |}}
==== Internal Registers =====
Internal registers (M) only operate within the program. Unless connected to
an actual external port, they are only used internally. M registers can be
used as input or output symbols.
{{ :cubloc:starting_ladder_logic:internalregisters.png?nolink |}}
==== P Registers Not Used as I/O Ports =====
Cubloc supports P registers from P0 to P127. P registers are directly
connected to I/O ports one to one. However, most models of Cubloc have
less than 128 I/O ports. Those P registers not connected to an I/O port can
be used as internal registers (M registers).
[[cubloc:index#Ladder_Logic:|Go CUBLOC Ladder Logic home]]