KV-X Series System Variable List (Global Variables)
A list of the global variables (variable name, member name, description, data type, read/write, assignment) given in "Appendix 2 System Variable List" of the KEYENCE KV-X500/X300 Series User's Manual.
Date/time and day of week
Variables related to the CPU unit's clock information (calendar timer).
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _CurrentDateTime | ARRAY[0..5] OF UINT | ||||
| _CurrentDateTime[0] | Year | UINT | R | CM700 | |
| _CurrentDateTime[1] | Month | UINT | R | CM701 | |
| _CurrentDateTime[2] | Day | UINT | R | CM702 | |
| _CurrentDateTime[3] | Hour | UINT | R | CM703 | |
| _CurrentDateTime[4] | Minute | UINT | R | CM704 | |
| _CurrentDateTime[5] | Second | UINT | R | CM705 | |
| _DayOfWeek | Day of week (0: Sunday to 6: Saturday) | UINT | R | CM706 | |
Always ON, always OFF, clock pulses
| Variable name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|
| _AlwaysOn | Always ON | BOOL | R | CR2002 |
| _AlwaysOff | Always OFF | BOOL | R | CR2003 |
| _Clock10ms | 10 ms clock pulse | BOOL | R | CR2004 |
| _Clock100ms | 100 ms clock pulse | BOOL | R | CR2005 |
| _Clock1s | 1 s clock pulse | BOOL | R | CR2006 |
| _FirstScanOff | OFF for 1 scan only at start of operation | BOOL | R | CR2007 |
| _FirstScanOn | ON for 1 scan only at start of operation | BOOL | R | CR2008 |
Program execution information
System variables related to program execution information.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _ProgramInfo | _PROGRAM_INFO | ||||
| ScanTime | Measured scan time | UDINT | R | CM1000 | |
| EndProcTime | Measured END processing time | UDINT | R | CM1002 | |
| MinScanTime | Minimum scan time | UDINT | R | CM1004 | |
| MaxScanTime | Maximum scan time | UDINT | R | CM1006 | |
| FixScanTimeSet | Constant scan time operation setting | UDINT | W | CM1008 | |
| EndProcTimeSet | END processing time setting | UDINT | W | CM1010 | |
| ExcessConstantScanTime | Scan time when setting exceeded | UDINT | R | CM1012 | |
| ExecssEndProcTime | END processing time when setting exceeded | UDINT | R | CM1014 | |
| ProgramErrorDetail | Operation error details | UINT | R | CM1023 | |
| FixScanTimeEnable | Constant scan time operation (ON: enabled / OFF: disabled) | BOOL | R | CM1024.3 | |
| FixTimeExcess | Set time exceeded (ON for 1 scan when the constant scan time or constant END processing time setting is exceeded) | BOOL | R | CM1024.4 | |
| OCPDisabled | Overcurrent protection disabled | BOOL | R | CM1024.5 | |
| BackupBattError | Backup battery error | BOOL | R | CM1024.6 | |
| ScanTimeMaxMinClear | Clear minimum/maximum scan time | BOOL | CM1024.7 | ||
| FixEndProcTimeEnable | END processing time setting (ON: enabled / OFF: disabled) | BOOL | CM1024.8 | ||
| TimeError | Clock error | BOOL | R | CM1024.11 | |
| ProjectPasswordAuthDisabled | Project password authentication prohibited (ON: prohibited / OFF: allowed) | BOOL | R | CM1024.14 | |
Free-running counters
Counters that count up from 0 when the CPU unit switches to RUN mode.
| Variable name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|
| _FreeRunCounter1ms | 32-bit 1 ms free-running counter | UDINT | R | CM1030 |
| _FreeRunCounter10us | 32-bit 10 μs free-running counter | UDINT | R | CM1032 |
| _FreeRunCounter1us | 32-bit 1 μs free-running counter | UDINT | R | CM1034 |
| _FreeRunCounter100ns | 32-bit 100 ns free-running counter | UDINT | R | CM1036 |
Errors
System variables related to CPU unit errors.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _ErrorCtrl | _ERROR_CTRL | ||||
| Error | Major error occurring | BOOL | R | CM1050.5 | |
| Warning | Minor error occurring | BOOL | R | CM1050.6 | |
| ClearCurrentError | Clear current error | BOOL | W | CM1050.9 | |
| ClearHistory | Clear history | BOOL | W | CM1050.10 | |
Logging/trace
System variables related to the logging/trace function.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _LoggingTrace | ARRAY[0..9] OF _LOGGING_TRACE | ||||
| ExecEnable | Enable operation | BOOL | W | CM1600.0 | |
| InOperation | Busy | BOOL | R | CM1600.1 | |
| FileWriteEnd | File write finished | BOOL | R | CM1600.2 | |
| BufferHalfAlm | Buffer below 50% warning | BOOL | R | CM1600.3 | |
| BufferOverflow | Buffer overflow | BOOL | R | CM1600.4 | |
| WriteDuringRun | Written during RUN while executing | BOOL | R | CM1600.5 | |
| LoggingTraceError | Logging/trace error | BOOL | R | CM1600.8 | |
| NoMemoryCapacity | Insufficient memory error | BOOL | R | CM1600.9 | |
| DeviceTriggerSetError | Device/trigger setting error | BOOL | R | CM1600.10 | |
| FileSaveTriggerMonitor | File save trigger monitor | BOOL | R | CM1600.11 | |
| DataAcquireComplete | Data acquisition complete | BOOL | R | CM1600.12 | |
| MinBufferSpace | Minimum free buffer space | UINT | R | CM1601 | |
| LoopBufferSpace | Free ring buffer space | UINT | R | CM1602 | |
| FileSavingCounter | File save counter | UINT | R | CM1603 | |
* The assignment for logging/trace (ID1 to 9, N: logging/trace ID) is "CM1600 + 10 × N".
Access Window
System variables related to the Access Window of the CPU unit.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _AccessWindow | Access Window | _ACCESS_WINDOW | |||
| UpKeyPressed | Up key pressed | BOOL | R | CM1720.0 | |
| DownKeyPressed | Down key pressed | BOOL | R | CM1720.1 | |
| LeftKeyPressed | Left key pressed | BOOL | R | CM1720.2 | |
| RightKeyPressed | Right key pressed | BOOL | R | CM1720.3 | |
| MenuKeyPressed | MENU key pressed | BOOL | R | CM1720.4 | |
| EnterKeyPressed | ENTER key pressed | BOOL | R | CM1720.5 | |
| UserMessageDisplayed | User message displayed | BOOL | R | CM1720.15 | |
| BlinkLine | Blink | ARRAY[1..4] OF BOOL | W | CM1721.0~CM1721.3 | |
| DisplayUserMessage | Display user message | ARRAY[1..63] OF BOOL | W | CM1722.1~CM1725.15 | |
| UserMessageDisplayID | User message display number | UINT | W | CM1730 | |
| InitialDispLangSetting | Initial display language setting | UINT | W | CM1731 | |
| InitialCommentNumberSetting | Initial comment number setting | UINT | W | CM1732 | |
| WindowOperationDisable | Operation prohibit setting | UINT | W | CM1733 | |
| InitScreenSetValid | Initial screen setting enabled | UINT | W | CM1734 | |
| InitScreenSetDeviceType | Initial screen setting: device type | UINT | W | CM1735 | |
| InitScreenSetScreenID | Initial screen setting: screen ID | UDINT | W | CM1736 | |
| InitScreenSetDeviceNumber | Initial screen setting: screen device number | UDINT | W | CM1738 | |
| InitScreenSetDisplayFormat | Initial screen setting: display format | UINT | W | CM1740 | |
| InitScreenSetDeviceDisplay | Initial screen setting: device notation | UINT | W | CM1741 | |
| InitScreenSetKeyLockStatus | Initial screen setting: key lock status | UINT | W | CM1742 | |
Project information
System variables related to the project information of the CPU unit.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _ProjectInfo | PROJECT_INFO | ||||
| ProjectName | Project name | STRING[64] | R | CM1750 | |
| SensorInstExecCount | Number of sensor setting instructions executed | UINT | R | CM1784 | |
| PrjPasswordCertFailCount | Consecutive project password authentication failures | UINT | R | CM1785 | |
| PrjPasswordCertFailTotal | Cumulative project password authentication failures | UINT | R | CM1786 | |
| CpuFuncVersion | CPU function version | UINT | R | CM1788 | |
| ProjectVersion | Project function version | UINT | R | CM1795 | |
Storage
System variables related to the storage (memory card / CPU memory) of the CPU unit.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _Storage | _STORAGE | ||||
| MemCardMountReq | Memory card mount request | BOOL | W | CM1800.0 | |
| MemCardUnmountReq | Memory card unmount request | BOOL | W | CM1800.1 | |
| MemCardInUse | Memory card in use | BOOL | R | CM1800.2 | |
| MemCardRecognized | Memory card recognition complete | BOOL | R | CM1800.3 | |
| MemCardExist | Memory card present | BOOL | R | CM1800.4 | |
| CpuMemoryMountReq | CPU memory mount request | BOOL | W | CM1800.8 | |
| CpuMemoryUnmountReq | CPU memory unmount request | BOOL | W | CM1800.9 | |
| CpuMemoryInUse | CPU memory in use | BOOL | R | CM1800.10 | |
| CpuMemoryRecognized | CPU memory recognition complete | BOOL | R | CM1800.11 | |
| AutoLoad | Auto load | _AUTOLOAD_CTRL | |||
| AutoLoad.FolderNumber | Folder number | UINT | W | CM1804 | |
| AutoLoad.CompleteFolderNumber | Completed folder number | UINT | R | CM1806 | |
| AutoLoad.FinCode | Completion code | UINT | R | CM1807 | |
| RunLoad | Run load | _AUTOLOAD_CTRL | CM1810 | ||
| RunLoad.FolderNumber | Folder number | UINT | W | CM1811 | |
| RunLoad.CompleteFolderNumber | Completed folder number | UINT | R | CM1813 | |
| RunLoad.FinCode | Completion code | UINT | R | CM1814 | |
| ProjectSave | Project save | _PROJECT_RECIPE_SAVE_LOAD | |||
| ProjectSave.Request | Execute request | BOOL | W | CM1820.0 | |
| ProjectSave.Busy | Executing | BOOL | R | CM1820.1 | |
| ProjectSave.Complete | Execution complete | BOOL | R | CM1820.2 | |
| ProjectSave.Error | Execution failed | BOOL | R | CM1820.3 | |
| ProjectSave.DriveNumber | Drive number | UINT | W | CM1821 | |
| ProjectSave.FolderNumber | Folder number | UINT | W | CM1822 | |
| ProjectSave.CompleteDriveNumber | Completed drive number | UINT | R | CM1823 | |
| ProjectSave.CompleteFolderNumber | Completed folder number | UINT | R | CM1824 | |
| ProjectSave.FinCode | Completion code | UINT | R | CM1825 | |
| ProjectLoad | Project load | _PROJECT_RECIPE_SAVE_LOAD | |||
| ProjectLoad.Request | Execute request | BOOL | W | CM1830.0 | |
| ProjectLoad.Busy | Executing | BOOL | R | CM1830.1 | |
| ProjectLoad.Complete | Execution complete | BOOL | R | CM1830.2 | |
| ProjectLoad.Error | Execution failed | BOOL | R | CM1830.3 | |
| ProjectLoad.DriveNumber | Drive number | UINT | W | CM1831 | |
| ProjectLoad.FolderNumber | Folder number | UINT | W | CM1832 | |
| ProjectLoad.CompleteDriveNumber | Completed drive number | UINT | R | CM1833 | |
| ProjectLoad.CompleteFolderNumber | Completed folder number | UINT | R | CM1834 | |
| ProjectLoad.FinCode | Completion code | UINT | R | CM1835 | |
| RecipeSave | Recipe save | _RECIPE_SAVE | CM1840 | ||
| RecipeSave.Request | Execute request | BOOL | W | CM1840.0 | |
| RecipeSave.Busy | Executing | BOOL | R | CM1840.1 | |
| RecipeSave.Complete | Execution complete | BOOL | R | CM1840.2 | |
| RecipeSave.Error | Execution failed | BOOL | R | CM1840.3 | |
| RecipeSave.DriveNumber | Drive number | UINT | W | CM1841 | |
| RecipeSave.InputFolderNumber | Reference folder number | UINT | W | CM1842 | |
| RecipeSave.OutputFolderNumber | Output folder number | UINT | W | CM1844 | |
| RecipeSave.FinCode | Completion code | UINT | R | CM1845 | |
| RecipeLoad | Recipe load | _PROJECT_RECIPE_SAVE_LOAD | |||
| RecipeLoad.Request | Execute request | BOOL | W | CM1850.0 | |
| RecipeLoad.Busy | Executing | BOOL | R | CM1850.1 | |
| RecipeLoad.Complete | Execution complete | BOOL | R | CM1850.2 | |
| RecipeLoad.Error | Execution failed | BOOL | R | CM1850.3 | |
| RecipeLoad.DriveNumber | Drive number | UINT | W | CM1851 | |
| RecipeLoad.FolderNumber | Folder number | UINT | W | CM1852 | |
| RecipeLoad.CompleteDriveNumber | Completed drive number | UINT | R | CM1853 | |
| RecipeLoad.CompleteFolderNumber | Completed folder number | UINT | R | CM1854 | |
| RecipeLoad.FinCode | Completion code | UINT | R | CM1855 | |
| CpuMemorySave | Save to CPU memory | _CPU_MEMORY_SAVE | |||
| CpuMemorySave.Request | Execute request | BOOL | W | CM1860.0 | |
| CpuMemorySave.Busy | Executing | BOOL | R | CM1860.1 | |
| CpuMemorySave.Complete | Execution complete | BOOL | W | CM1860.2 | |
| CpuMemorySave.Error | Execution failed | BOOL | R | CM1860.3 | |
| StorageFBIsRAMMode | Storage FB RAM mode | BOOL | W | CM1861.7 | |
| ProjectBackupBusy | Project backup in progress | BOOL | R | CM1861.8 | |
| LoggingTraceBusy | Logging/trace in progress | BOOL | R | CM1861.10 | |
| LoggingInternalBufferOverflow | Logging internal buffer overflow | BOOL | R | CM1861.11 | |
| PowerOffDuringStorageAccess | Power OFF during storage access | UINT | W | CM1870 | |
| MemoryCardRetryCount | Memory card retry count | UINT | R | CM1871 | |
| MemoryCardErrorCount | Memory card verify error count | UINT | R | CM1872 | |
| MemoryCardResetDelay | Reset delay time on memory card error | UINT | W | CM1874 | |
| UsageCpuMemory | CPU memory usage | UDINT | R | CM1880 | |
Expansion units
System variables related to connected expansion units.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _ExpansionUnit | _EXPANSION_UNIT | ||||
| Connected | Expansion unit connected (unit number 0 is fixed OFF) | ARRAY[0..48] OF BOOL | R | CM2000 | |
| LoadOption | Load option | ARRAY[0..48] OF BOOL | W | CM2004 | |
| UnitNumber | Number of connected expansion units (the CPU unit is not counted) | UINT | R | CM2075 | |
Inter-unit synchronization
System variables related to inter-unit synchronization.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _UnitSynchronize | _UNIT_SYNCHRONIZE | ||||
| RefreshStartTimeDelay | Inter-unit synchronization refresh start time | UDINT | R | CM2400 | |
| RefreshFinishTimeDelay | Inter-unit synchronization refresh end time | UDINT | R | CM2402 | |
| RefreshStartTimeMaxDelay | Inter-unit synchronization maximum start time | UDINT | R | CM2404 | |
| RefreshFinishTimeMaxDelay | Inter-unit synchronization maximum end time | UDINT | R | CM2406 | |
| RefreshExecutionTime | Inter-unit synchronization refresh execution time | UDINT | R | CM2408 | |
| RefreshIntervalOver | Inter-unit synchronization refresh time exceeded | BOOL | R | CM2410.0 | |
Latest major error details
System variables that store detailed information when a major error occurs in the CPU unit.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _NewestError | _ERROR_DETAIL | ||||
| YearMonth | Year/month (2402 means February 2024) | UINT | R | CM5100 | |
| Day | Day | UINT | R | CM5101 | |
| Hour | Hour | UINT | R | CM5102 | |
| Minute | Minute | UINT | R | CM5103 | |
| Second | Second | UINT | R | CM5104 | |
| ErrorNumber | Error code | UINT | R | CM5105 | |
| ValidCount | Number of valid data | UINT | R | CM5106 | |
| Detail | Detail information 01 to 20 | ARRAY[0..19] OF UINT | R | CM5107~CM5126 | |
Latest minor error details
System variables that store detailed information when a minor error occurs in the CPU unit.
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _NewestWarning | _ERROR_DETAIL | ||||
| YearMonth | Year/month (2402 means February 2024) | UINT | R | CM5150 | |
| Day | Day | UINT | R | CM5151 | |
| Hour | Hour | UINT | R | CM5152 | |
| Minute | Minute | UINT | R | CM5153 | |
| Second | Second | UINT | R | CM5154 | |
| ErrorNumber | Error code | UINT | R | CM5155 | |
| ValidCount | Number of valid data | UINT | R | CM5160 | |
| Detail | Detail information 01 to 20 | ARRAY[0..19] OF UINT | R | CM5157~CM5176 | |
Operation recording
System variables related to the operation recording function (drive recorder function).
| Variable name | Member name | Description | Data type | R/W | Assignment |
|---|---|---|---|---|---|
| _OperationRecorder | ARRAY[0..3] OF _OPERATION_RECORDER | ||||
| SaveRequest | Save request | BOOL | R | CM6000.0 | |
| InAction | Busy | BOOL | R | CM6000.1 | |
| SaveTriggerMonitor | File save trigger occurred | BOOL | R | CM6000.2 | |
| SaveBusy | Saving file | BOOL | R | CM6000.3 | |
| Collecting | Collecting data | BOOL | R | CM6000.4 | |
| SettingError | Setting error | BOOL | R | CM6000.5 | |
| SaveComplete | File save complete | BOOL | R | CM6000.7 | |
| SaveError | File save error | BOOL | R | CM6000.8 | |
| BufferShortage | Insufficient recording buffer | BOOL | R | CM6000.9 | |
| BufferAllSaveMode | Save entire buffer mode | BOOL | R | CM6000.14 | |
| AverageSamplingPeriod | Average sampling period | DINT | R | CM6002 | |
| AverageChangedDeviceNum | Average number of changed devices | DINT | R | CM6004 | |
| MaxCollectingPeriod | Collectable period | DINT | R | CM6006 | |
| SaveFinCode | File save completion code | UINT | R | CM6020 | |
| SaveCounter | File save counter | UINT | R | CM6022 | |
| SaveProgressInfo1 | Save progress detail 1 | UINT | R | CM6024 | |
| SaveProgressInfo2 | Save progress detail 2 | UINT | R | CM6025 | |
| SaveProgress | Save progress | UINT | R | CM6026 | |
| SavePath | Save file path | STRING[320] | R | CM6030~CM6191 | |
* The assignment for operation recording (ID1 to ID3, N: operation recording ID) is "CM1600 + 200 × N".
Module executing
System variables that store the execution state of modules.
| Variable name | Description | Data type | R/W |
|---|---|---|---|
| _MD_(ModuleName) | Turns ON while the module specified by ModuleName is executing. e.g. while the "Auto" module is executing, _MD_Auto is ON Used, for example, to control the execution of standby modules. | BOOL | R |
Expansion unit device addresses
System variables that store the device addresses of the first R and first DM of the specified expansion unit.
| Variable name | Member name | Description | Data type | R/W |
|---|---|---|---|---|
| _UnitIdAdr[0..48] | ARRAY[0..48] OF _UNIT_ID_ADR | |||
| UnitNo | Unit number of the target unit | UINT | R | |
| RelayAdr | First relay address of the target unit *Specifying _UnitIdAdr[#1].RelayAdr designates the relays assigned to the unit. | UDINT | R | |
| DmAdr | First DM address of the target unit *Specifying _UnitIdAdr[#1].DmAdr designates the DM assigned to the unit. | UDINT | R | |
The values stored in _UnitAdr are shown using the following unit configuration as an example.
| Unit number | Model | First R | First DM |
|---|---|---|---|
| 0 | KV-X550 | R30000 | DM10000 |
| 1 | KV-SSC02 | R33000 | DM10300 |
| 2 | KV-SAD04 | R34000 | DM10400 |
*Writing _UnitAdr[#1].RelayAdr handles the first relay R33000 of the KV-SSC02 (unit number #1).
*Writing _UnitAdr[#2].DmAdr handles the first DM10400 of the KV-SAD04 (unit number #2).
To handle devices other than the first one, use instructions that add/subtract addresses (DevAddressAdd etc.) (e.g. to handle first R + 20 "ch1 current value write request" of the KV-SSC02, see the ladder example on page A-16 of the manual).
Arithmetic flags
System variables that store the execution results of some instructions.
| Variable name | Description | Data type | R/W |
|---|---|---|---|
| _CalcResultNeg | Turns ON when the comparison result is less. | BOOL | R |
| _CalcResultEqual | Turns ON when the comparison result is equal. | BOOL | R |
| _CalcResultPos | Turns ON when the comparison result is greater. | BOOL | R |
