写了这么久程序,都没有分享点,今天分享点最基础实用的,还望大家指教
以0x55起始 0xDD结尾 的数据包
#include <Nordic\reg24le1.h>
#include <intrins.h>
#include <stdint.h>
#define PIN32
#ifdef PIN32
//定义I/O口方向
#define p0dir 0xf0
#define p1dir 0xff
#endif
#define INTERRUPT_UART0 4 // UART0, Receive & Transmitt interrupt
#define TX_PLOAD_WIDTH 30 // 数据包长度为30 bytes
uint8_t uart_rx[TX_PLOAD_WIDTH];
uint8_t uart_rx_cnt=0; //用于uart_rx数组计数
uint8_t recdat=0; //缓存串口接收到的字节
uint8_t state=0; //串口接收状态机
uint8_t uart_flag=0; //串口接收完一帧数据的标志位
uint8_t len_cnt=0; //存储数据包里面规定的数据长度
/**************************************************
功能:串口中断服务程序
****************