# SerialProtocol **Repository Path**: ddzxlining/serial-protocol ## Basic Information - **Project Name**: SerialProtocol - **Description**: 个人实现的通过串口进行单片机与电脑之间的通信协议。主要用来控制单片机读写RFID卡。单片机为STC89C52RC,读卡模块为RC522. - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2020-10-27 - **Last Updated**: 2022-04-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 协议定义 1.数据帧格式 | 字段名 | 数据类型 | 定义| | ---- | ---- |---- | | head | u8 | 数据帧的开始 0xaa | direction | u8 | 数据流向,0x00表示单片机到上位机,0xff表示上位机到单片机 | len | u8| 数据长度 |opt|u8 |操作类型| | data | u8 *32 | 数据部分,最大32个字节 | tail | u8 | 数据帧的结束 0xdd ``` typedef struct{ u8 head; u8 direction; u8 length; u8 data[32]; u8 tail; } TranData; ```