User Tools

Site Tools



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 2,In,BKEY
UsePin 3,Out,MOTOR
Alias M0=RELAYSTATE      'Aliases
Set Ladder On            'Start Ladder
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.

Input, Output Register Symbol

Input/Output registers are the most basic symbols among the registers in Ladder Logic.


Function include timers, counters, and other mathematical operation registers.

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.

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).

Go CUBLOC Ladder Logic home

cubloc/starting_ladder_logic/index.txt · Last modified: 2016/04/14 11:07 (external edit)