Get MBLogic at Fast, secure and Free Open Source 
		software downloads

Help Topics

Topic Details for MBLogicEngine

Help - Soft Logic Addresses


Data for the "Ck" soft logic library is stored in a data table which is divided into distinct types. The sizes and limits on the data table and constants are defined below.

Data Types:

Type Size (bytes) Min Value Max Value
Signed integer 2 -32768 32767
Signed double integer 4 -2147483648 2147483647
Floating point Undefined -3.40E+038 3.40E+038
Unsigned integer (hex) 2 0 65535
Single character 1 N/A N/A
Text string Undefined N/A N/A

Data Table Addresses:

All data is stored in data table addresses. These addresses are either "bit" (boolean) or "register" (word) addresses. Each data table begins at "1" (not "0"), and extends to the maximum address listed below.

Prefix Description Max Type Example
X Inputs 2000 Boolean X9
Y Outputs 2000 Boolean Y1023
C Control relays 2000 Boolean C58
T Timer status 500 Boolean T421
CT Counter status 250 Boolean CT6
SC System control 1000 Boolean SC21
DS Data register 10000 Integer DS6432
DD Data register 2000 Double integer DD4
DH Data register 2000 Unsigned integer DH100
DF Data register 2000 Floating point DF57
XD Input register 125 Unsigned integer XD1
YD Output register 125 Unsigned integer YD99
XS Input register 125 Signed integer XS1
YS Output register 125 Signed integer YS99
TD Timer current value 500 Integer TD45
CTD Counter current value 250 Double integer CTD3
SD System data 1000 Integer SD9
TXT Text data 10000 ASCII TXT7420

Differences from the Koyo "Click"

The maximum address permitted by the Ck soft logic library is in some cases larger than that permitted by the Koyo "Click".

The Ck library implements the X, Y, XD, and YD addresses slightly differently from the Koyo "Click". This is because the I/O hardware is different, which means that an exact correspondence would make little sense.

The differences are as follows:


Data table addresses must be represented exactly as defined. Case is significant, so while X1 is a valid address, x1 is not. Leading zeros are not permitted. X1 is a valid address, X01 is not.


Many instructions which accept registers addresses as inputs will also accept constants. The type of constant must be compatible with the parameter expected by the instruction.

Type Example
KInt Signed integer 125
KDInt Signed double integer -50000
KF Floating point 123.456 or 1.23456E+2
KHex Unsigned integer (hex) f73h
KTxtChar Single character "A"
KTxtStr Text string "abc123"

System Control Relays:

System control relays are used to provide convenience functions, or to signal error conditions.

Address Description
SC1 Always ON
SC2 ON for the first program scan
SC3 Turns on and off on alternate scans
SC4 Free running clock with a 10ms period
SC5 Free running clock with a 100ms period
SC6 Free running clock with a 500ms period
SC7 Free running clock with a 1sec period
SC8 Free running clock with a 1m period
SC9 Free running clock with a 1 hour period
SC19 ON if an error occurs
SC24 There is no PLC program, or the program is invalid.
SC25 The run time system is not compatible with the program version.
SC26 The watch time timer timed out.
SC27 The data table contents were lost.
SC40 An attempt was made to divide by zero.
SC43 Data overflow, underflow, or data conversion error.
SC44 An invalid address was used
SC46 A math error occurred
SC50 Set run mode to stop.1
SC51 Resets watchdog timer to zero.1

Notes: 1 = Not implemented at this time. The SC relays are currently not writable by a user instruction.

System Control Registers:

System control registers are used to provide convenience functions, or to signal error conditions.

Address Description
SD1 Current PLC error code
SD5 Low word of runtime version
SD6 High word of runtime version
SD9 Counts number of scans (rolls over at 32,767)
SD10 The current scan time
SD11 The minimum scan time since starting
SD12 The maximum scan time since starting


Subroutines are referenced by names which may be from 1 to 24 characters long and which may contain the charcters a to z, A to Z and 1 to 9. No other characters are permitted, and no spaces are permitted within the name. Examples, "SubroutineName1", or "123ValidName". The following are invalid names "ThisNameIsMuchTooLongToBeAccepted", and "Bad&Characters*"

There is no limit to the number of subroutines permitted, but each subroutine name must be unique.