# rs232c **Repository Path**: pleasant-ding/rs232c ## Basic Information - **Project Name**: rs232c - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-03-02 - **Last Updated**: 2025-03-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # RS232C 编码/解码程序 ## 功能 - 将字符按RS232C标准编码为电压序列,包含空闲位、起始位和停止位。 - 从电压序列中解码出原始字符。 ## 帧结构 - **空闲位**:1位高电平(1.0V) - **起始位**:1位低电平(0.0V) - **数据位**:7位小端序(LSB到MSB) - **停止位**:1位高电平(1.0V) - 每字符共10位。 ## 电压值约定 - 逻辑1:1.0V - 逻辑0:0.0V ## 使用示例 ```c char msg[] = "A"; double volts[10]; int encoded = rs232c_encode(volts, 10, msg, 1); char decoded[1]; int decoded_size = rs232c_decode(decoded, 1, volts, 10);