CiA 402 状态与控制字速查
用 Statusword 判断状态
先取状态机相关位:
// 0x006F 只保留状态机判定需要的 bit;Remote、Target reached 等附加位会被清零。
// 得到的 state 才能与下表状态模式比较,不能拿完整 statusword 直接比较。
uint16_t state = statusword & 0x006FU;
state | 状态 |
|---|---|
0x0000 | Not ready to switch on |
0x0040 | Switch on disabled |
0x0021 | Ready to switch on |
0x0023 | Switched on |
0x0027 | Operation enabled |
0x0007 | Quick stop active |
0x000F | Fault reaction active |
0x0008 | Fault |
不要用完整 Statusword 与表中数字直接相等。Target reached、Remote 等其他 bit 可能同时为 1。
Statusword 常用位
| bit | 掩码 | 含义 |
|---|---|---|
| 0 | 0x0001 | Ready to switch on |
| 1 | 0x0002 | Switched on |
| 2 | 0x0004 | Operation enabled |
| 3 | 0x0008 | Fault |
| 4 | 0x0010 | Voltage enabled |
| 5 | 0x0020 | Quick stop |
| 6 | 0x0040 | Switch on disabled |
| 7 | 0x0080 | Warning |
| 9 | 0x0200 | Remote |
| 10 | 0x0400 | Target reached |
| 11 | 0x0800 | Internal limit active |
| 12 | 0x1000 | 模式相关;Profile Position 中常作 set-point acknowledge |
本课程使能路径
| 当前步骤 | 写入 0x6040 | 写后读取 0x6041 |
|---|---|---|
| Shutdown | 0x0006 | 期望 Ready to switch on 或已处于更后状态 |
| Switch on | 0x0007 | 期望 Switched on 或 Operation enabled |
| Enable operation | 0x000F | 必须确认 Operation enabled |
其他常见控制字
| 值/位 | 常见用途 | 注意 |
|---|---|---|
0x0000 | Disable voltage | 设备行为仍需结合当前状态 |
0x0002 | Quick stop 请求 | 减速方式由设备参数决定 |
bit 7,0x0080 | Fault reset | 先查故障原因,不要自动循环复位 |
bit 4,0x0010 | Profile Position new set-point | 要按模式规定产生变化 |
bit 5,0x0020 | Profile Position change set immediately | 结合厂家和 CiA 402 行为使用 |
bit 6,0x0040 | Profile Position absolute/relative | 位含义需结合模式 |
控制字不是“越大动作越强”的数值。它是 bit 组合,必须按状态机和当前模式解释。