MBLogic for an open world in automation
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.
|Type||Size (bytes)||Min Value||Max Value|
|Signed double integer||4||-2147483648||2147483647|
|Unsigned integer (hex)||2||0||65535|
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.
|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|
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.
|KDInt||Signed double integer||-50000|
|KF||Floating point||123.456 or 1.23456E+2|
|KHex||Unsigned integer (hex)||f73h|
System control relays are used to provide convenience functions, or to signal error conditions.
|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 are used to provide convenience functions, or to signal error conditions.
|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.