# Serial PWM Control Message Protocol --- ## System Structure ### Per building Setting ![](https://i.imgur.com/kRgRFve.png) ### Project Details ![](https://i.imgur.com/OItHpwh.png) ## Form and Installation ![](https://i.imgur.com/6ckvhMu.png) ## UART RS-485 System Topologies * Control box ![](https://i.imgur.com/I7knoSL.png) * End point PWM Control ![](https://i.imgur.com/IHvelvJ.png) --- ## Polling Request Format (UART / RS-485) * Master 輪巡 Request。 * 開機後 master 輪巡 (address 1 ~ 255) 一次。 * Polling Timeout = 200 msec, Polling Retry = 1 次。 * master 記錄在線清單, 失敗以斷線計。 * Time example = 2023/04/22 18:48:22 以6組十進位表示 |Poll Request STX|Address|Current Time|CRC-CCITT|Poll Request ETX| |---|---|---|---|---| |1 Byte|1 Byte|6 Bytes|2 Bytes |1 Byte| |0x71|1 ~ 255|YYMMDDHHmmSS - 230422184822 |CRC result (Address+Current Time)|0x8e| ## Polling Response Format (UART / RS-485) * Slave Response Master PWM 設定。 * Slave 更新時間。 * |Poll Response STX|Address|Current PWM Settings|CRC-CCITT|Poll Response ETX| |---|---|---|---|---| |1 byte|1 byte|4 bytes|2 bytes|1 byte| |0x72|1 ~ 255|PWM1, PWM2, PWM3, PWM4|CRC result (Address+PWM Settings)|0x8d| --- ## Set PWM Setting (UART / RS-485) * 24 小時內最多可設定 10 組 PWM 時段 (儲存於 Flash) |Set PWM STX|Address|Set HHmm|Set Duration|Set PWMs|CRC-CCITT|Set PWM ETX| |---|---|---|---|---|---|---| |1 byte|1 byte|2 bytes|1 byte|4 bytes|2 bytes|1 byte| |0x73|1 ~ 255|1402 = 02:02pm|20 (minute)|0: off, 255: on|CRC result (Adress ~ Set PWMs) |0x8c| ## Get PWM Settings (UART / RS-485) * n <= 10 |Get PWM STX|Address|PWM setting 1| ... | PWM setting n |CRC-CCITT|Get PWM ETX| |---|---|---|---|---|---|---| |1 byte|1 byte|7 bytes|7 bytes * (n-2)|7 bytes|2 bytes|1 byte| |0x74|1 ~ 255|HHmm, duration, PWM1, PWM2, PWM3, PWM4|HHmm, duration, PWM1, PWM2, PWM3, PWM4|HHmm, duration, PWM1, PWM2, PWM3, PWM4|CRC Result (Address~PWM setting n)|0x8b| --- ## Clear PWM Settings (UART / RS-485) * 命令清除全部時段 PWM 設定。 |Clr PWM STX|Address|CRC_CCITT|Clr PWM ETX| |---|---|---|---| |1 byte|1 byte|2 bytes|1 byte| |0x75|1 ~ 255| CRC result (Address) | 0x8a| --- ## IR System Topologies ![](https://i.imgur.com/6aqGV0j.png) --- ## IR Carrier Format and Logic ![](https://i.imgur.com/8oVGSR6.png) ## IR Frame Format ![](https://i.imgur.com/kY5MT06.png) ## Address Format * 與上圖 Frame Format 稍有不同之處如下: * group = 橫向 5 組 * address = 縱向 254 組 (max) |group|address| |---|---| |1 ~ 5| 0: 全域, 1 ~ 254: 單一| ## Data Formats ### Group Polling Request Format *檢查橫向 IR 連線 | ### Gruop Polling Response Format | --- ## LED Dot Matrix 設定 按鈕互動流程 (TBD) ![](https://i.imgur.com/5M2Kz9c.png) * 上下鍵 * * 左右鍵 * * 選擇鍵 * --- --- ## CRC-CCITT 規格 ![](https://i.imgur.com/b0oilhp.png) ![](https://i.imgur.com/RaPJkdz.png) [crc calculator](http://www.ip33.com/crc.html) --- ## Notes > Protocol is **applicable** to all following hardware interfaces: > 1. UART: **PWM / RS-485** Controller, BAUD=9600, 8N1