C51 COMPILER V9.54 TPC_ROAD 09/06/2024 14:31:13 PAGE 1 C51 COMPILER V9.54, COMPILATION OF MODULE TPC_ROAD OBJECT MODULE PLACED IN ..\out\tpc_road.obj COMPILER INVOKED BY: E:\KeilC51\C51\BIN\C51.EXE ..\source\tpc\tpc_road.c LARGE OMF2 OPTIMIZE(0,SIZE) BROWSE ORDER NOINTP -ROMOTE INCDIR(..\source\bsp;..\source\msp;..\source\app;..\source\clib;..\source\cpu;..\source\ctask;..\source\tpc;..\so -urce\asp;..\source\debug;..\source\msp\uart;..\source\msp\simiic;..\source\bsp\oled;..\source\bsp\TTSSbsp) DEBUG PRINT(. -.\out\tpc_road.lst) TABS(2) OBJECT(..\out\tpc_road.obj) line level source 1 2 /***************************************************************************** 3 update by cc @201501101001 4 针对多串口 和 单一串口 有区别 每个串口是独立的还是分开的有讲究 程序是复 -的还是软件应用简单是 5 个需要平衡的事情. 6 7 uartcom/uartlib.c: 8 公用的函数 和硬件无关 9 放置串行模式(串口等其他通讯总线类的输出)输出的函数, 10 一些覆盖模式输出的(lcd等固屏输出的)的也可使用 11 void Lc_print(void (*L0pf_send_uc)(char ww), char *dat,...) 12 ----------------------------------------------------------------------------------------- 13 uartcom/uartcom0 14 和uart相关的通讯协议 com + n 15 为了适应不同的通讯协议需要不同的uart口来对应 和应用相关 16 17 typedef struct _ts_lcm_pro_; 应用协议包的定义? LCM的协议------------ 18 L3_UARTcom0_exp_protocol 解析应用协议 19 ----------------------------------------------------------------------------------------- 20 uartcom/uprotocol: 主要是为 uartcom + n服务的 驱动层到应用层缓存的过度 21 公用的串口通讯定义 22 struct _s_protocol_ 的公共协议包(关键的结构体)的声明------struct _s_protocol_ 23 void L1_uart_2buf(struct _s_protocol_ *p)串行数据保存到缓冲中 24 -------------------------------------------------------------------------------------------- 25 msp/uartx.c 底层代码 和cpu相关 26 L0_UART0_Init 27 UART0_IRQHandler 28 L0_Usend_uc----------s_at0 29 ----------------------------------------------------------------------------------------- 30 ********************************************************************************/ 31 32 #include "tpc_road.h" *** WARNING C320 IN LINE 51 OF ..\source\bsp\TTSSbsp\bsp_config.h: "MainFre_22M" 33 ///#include "c_lib.h" 34 35 ///TS_pp_debug_ ts_debug_rec; 36 ///TS_s2b_debug_ ts_s2b1_road;////协议处理变量 37 38 void L1_s2b_road_init(u8 ch) // 39 { 40 1 ts_Urec[ch].ok = 0; 41 1 ts_Urec[ch].debugok = 0; 42 1 ts_Urec[ch].head = 0; 43 1 ts_Urec[ch].num = 0; 44 1 ///printf("\r\nw ts_Urec[D_UART1].max = %d num = %d",(int)ts_Urec[D_UART1].rmax,(int)ts_Urec[D_UART1].num -); 45 1 } 46 47 //MODBUS协议解析函数 012345 48 //透传协议 就像路过 有时间超时溢出 收到啥就向上传递啥 49 void L1_s2b_road(u8 ch) C51 COMPILER V9.54 TPC_ROAD 09/06/2024 14:31:13 PAGE 2 50 { 51 1 /// ts_Urec[ch].ok = 1; 52 1 if(ts_Urec[ch].head == 0) 53 1 { 54 2 { 55 3 ts_Urec[ch].head = 1; 56 3 ts_Urec[ch].num = 0; 57 3 ts_Urec[ch].ok = 0; 58 3 ts_Urec[ch].fifo = 0; 59 3 ts_Urec[ch].sp[ts_Urec[ch].num ] = ts_Urec[ch].reg; 60 3 /// ts_Urec[ch].sp[ts_Urec[ch].num ] = SBUF;// L0_uart1_get();; 61 3 ts_Urec[ch].num ++; 62 3 } 63 2 } 64 1 else 65 1 { 66 2 ts_Urec[ch].sp[ts_Urec[ch].num ] = ts_Urec[ch].reg; 67 2 ts_Urec[ch].num ++; 68 2 /// ts_Urec[ch].len = ts_Urec[ch].num; 69 2 ts_Urec[ch].fifo = ts_Urec[ch].num; 70 2 if(ts_Urec[ch].num < ts_Urec[ch].rmax) 71 2 { 72 3 }else 73 2 {////保护使用 74 3 ts_Urec[ch].ok = 2; 75 3 ts_Urec[ch].debugok = 1; 76 3 ts_Urec[ch].head = 0; 77 3 ts_Urec[ch].num = 0; 78 3 } 79 2 } 80 1 } 81 82 void L1_s2b_road2(u8 ch) 83 { 84 1 if(ts_Urec[ch].head == 0) 85 1 { 86 2 { 87 3 ts_Urec[ch].head = 1; 88 3 ts_Urec[ch].num = 0; 89 3 ts_Urec[ch].ok = 0; 90 3 ts_Urec[ch].fifo = 0; 91 3 ts_Urec[ch].sp[ts_Urec[ch].num ++] = ts_Urec[ch].reg; 92 3 } 93 2 } 94 1 else 95 1 { 96 2 ts_Urec[ch].sp[ts_Urec[ch].num ++] = ts_Urec[ch].reg; 97 2 /// ts_Urec[ch].len = ts_Urec[ch].num; 98 2 ts_Urec[ch].fifo = ts_Urec[ch].num; 99 2 if(ts_Urec[ch].num < ts_Urec[ch].rmax) 100 2 { 101 3 }else 102 2 {////保护使用 103 3 ts_Urec[ch].ok = 2; 104 3 ts_Urec[ch].debugok = 1; 105 3 ts_Urec[ch].head = 0; 106 3 ts_Urec[ch].num = 0; 107 3 } 108 2 } 109 1 } 110 void L1_s2b_road3(u8 ch) 111 { C51 COMPILER V9.54 TPC_ROAD 09/06/2024 14:31:13 PAGE 3 112 1 if(ts_Urec[ch].head == 0) 113 1 { 114 2 { 115 3 ts_Urec[ch].head = 1; 116 3 ts_Urec[ch].num = 0; 117 3 ts_Urec[ch].ok = 0; 118 3 ts_Urec[ch].fifo = 0; 119 3 ts_Urec[ch].sp[ts_Urec[ch].num ++] = ts_Urec[ch].reg; 120 3 } 121 2 } 122 1 else 123 1 { 124 2 ts_Urec[ch].sp[ts_Urec[ch].num ++] = ts_Urec[ch].reg; 125 2 /// ts_Urec[ch].len = ts_Urec[ch].num; 126 2 ts_Urec[ch].fifo = ts_Urec[ch].num; 127 2 if(ts_Urec[ch].num < ts_Urec[ch].rmax) 128 2 { 129 3 }else 130 2 {////保护使用 131 3 ts_Urec[ch].ok = 2; 132 3 ts_Urec[ch].debugok = 1; 133 3 ts_Urec[ch].head = 0; 134 3 ts_Urec[ch].num = 0; 135 3 } 136 2 } 137 1 } 138 void L1_s2b_road4(u8 ch) 139 { 140 1 if(ts_Urec[ch].head == 0) 141 1 { 142 2 { 143 3 ts_Urec[ch].head = 1; 144 3 ts_Urec[ch].num = 0; 145 3 ts_Urec[ch].ok = 0; 146 3 ts_Urec[ch].fifo = 0; 147 3 ts_Urec[ch].sp[ts_Urec[ch].num ++] = ts_Urec[ch].reg; 148 3 } 149 2 } 150 1 else 151 1 { 152 2 ts_Urec[ch].sp[ts_Urec[ch].num ++] = ts_Urec[ch].reg; 153 2 /// ts_Urec[ch].len = ts_Urec[ch].num; 154 2 ts_Urec[ch].fifo = ts_Urec[ch].num; 155 2 if(ts_Urec[ch].num < ts_Urec[ch].rmax) 156 2 { 157 3 }else 158 2 {////保护使用 159 3 ts_Urec[ch].ok = 2; 160 3 ts_Urec[ch].debugok = 1; 161 3 ts_Urec[ch].head = 0; 162 3 ts_Urec[ch].num = 0; 163 3 } 164 2 } 165 1 } 166 167 168 /****************************************************************************** 169 ** End Of File 170 ******************************************************************************/ 171 172 /****************************************************************************** 173 ** c func lib C51 COMPILER V9.54 TPC_ROAD 09/06/2024 14:31:13 PAGE 4 174 175 void L1_s2b_road(TS_rec_road_ *p) 176 { 177 /// p->ok = 1; 178 if(p->head == 0) 179 { 180 { 181 p->head = 1; 182 //// p->max = D_debug_max; 183 p->num = 0; 184 p->ok = 0; 185 p->fifo = 0; 186 p->sp[p->num ++] = p->reg; 187 } 188 } 189 else 190 { 191 p->sp[p->num ++] = p->reg; 192 /// p->len = p->num; 193 p->fifo = p->num; 194 if(p->num < p->rmax) 195 { 196 }else 197 {////保护使用 198 p->ok = 2; 199 p->debugok = 1; 200 p->head = 0; 201 p->num = 0; 202 } 203 } 204 } 205 206 207 //透传协议 就像路过 有时间超时溢出 收到啥就向上传递啥 208 void L1_s2b_road2(TS_rec_road_ *p) 209 { 210 /// p->ok = 1; 211 if(p->head == 0) 212 { 213 { 214 p->head = 1; 215 //// p->max = D_debug_max; 216 p->num = 0; 217 p->ok = 0; 218 p->fifo = 0; 219 p->sp[p->num ++] = p->reg; 220 } 221 } 222 else 223 { 224 p->sp[p->num ++] = p->reg; 225 /// p->len = p->num; 226 p->fifo = p->num; 227 if(p->num < p->rmax) 228 { 229 }else 230 {////保护使用 231 p->ok = 2; 232 p->debugok = 1; 233 p->head = 0; 234 p->num = 0; 235 } C51 COMPILER V9.54 TPC_ROAD 09/06/2024 14:31:13 PAGE 5 236 } 237 } 238 239 void L1_s2b_road3(TS_rec_road_ *p) 240 { 241 /// p->ok = 1; 242 if(p->head == 0) 243 { 244 { 245 p->head = 1; 246 //// p->max = D_debug_max; 247 p->num = 0; 248 p->ok = 0; 249 p->fifo = 0; 250 p->sp[p->num ++] = p->reg; 251 } 252 } 253 else 254 { 255 p->sp[p->num ++] = p->reg; 256 /// p->len = p->num; 257 p->fifo = p->num; 258 if(p->num < p->rmax) 259 { 260 }else 261 {////保护使用 262 p->ok = 2; 263 p->debugok = 1; 264 p->head = 0; 265 p->num = 0; 266 } 267 } 268 } 269 void L1_s2b_road4(TS_rec_road_ *p) 270 { 271 /// p->ok = 1; 272 if(p->head == 0) 273 { 274 { 275 p->head = 1; 276 //// p->max = D_debug_max; 277 p->num = 0; 278 p->ok = 0; 279 p->fifo = 0; 280 p->sp[p->num ++] = p->reg; 281 } 282 } 283 else 284 { 285 p->sp[p->num ++] = p->reg; 286 /// p->len = p->num; 287 p->fifo = p->num; 288 if(p->num < p->rmax) 289 { 290 }else 291 {////保护使用 292 p->ok = 2; 293 p->debugok = 1; 294 p->head = 0; 295 p->num = 0; 296 } 297 } C51 COMPILER V9.54 TPC_ROAD 09/06/2024 14:31:13 PAGE 6 298 } 299 300 301 ******************************************************************************/ 302 MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 2019 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = 5 ---- PDATA SIZE = ---- ---- DATA SIZE = ---- ---- IDATA SIZE = ---- ---- BIT SIZE = ---- ---- EDATA SIZE = ---- ---- HDATA SIZE = ---- ---- XDATA CONST SIZE = ---- ---- FAR CONST SIZE = ---- ---- END OF MODULE INFORMATION. C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)