📄 16c554.lst
字号:
244 4
245 4 *siocInfo.rxCurPtr = chCRxd;
246 4 siocInfo.rxTimer = 10;
247 4 siocInfo.rxState = 1;
248 4 if( siocInfo.rxLen < 0xFF )
249 4 {
250 5 siocInfo.rxLen ++;
251 5 siocInfo.rxCurPtr ++;
252 5 }
253 4 }
254 3 else if( intPend == 0x02 )
255 3 {/*发送数据中断*/
256 4
257 4 if( siocInfo.txLen == 0 )
258 4 {
259 5 siocInfo.txState = 0;
260 5 }
261 4 else
262 4 {
263 5 chCTxd = *siocInfo.txPtr;
264 5 siocInfo.txPtr ++;
265 5 siocInfo.txLen --;
266 5 }
267 4
268 4 }
269 3 }
270 2
271 2 intSource = uartInt & 0xF0;
272 2 }
273 1
274 1
275 1 }
276
277
278 char at_serial_send(char *ptr, unsigned int len)
279 {
280 1
281 1 if( atInfo.txState )
282 1 return -1;
283 1 else
284 1 {
285 2 atInfo.txPtr = ptr;
286 2 atInfo.txLen = len & AT_MAX_SEND_BYTE;
287 2
288 2 chATxd = *atInfo.txPtr ++;
289 2 atInfo.txLen --;
290 2 return 0;
291 2 }
292 1 }
293
294 /***************************************************
295 *从GPRS模块接收数据的函数
296 *要求发送的数据长度不能大于AT_MAX_SEND_BYTE,否则将有部分数据不发送
297 *入口:接收数据存放指针
298 *返回值:返回接收到的字节数
299 ****************************************************/
300 unsigned int at_serial_receive(char **ptr)
301 {
C51 COMPILER V7.09 16C554 09/25/2008 11:56:16 PAGE 6
302 1 char *tmpPtr;
303 1 unsigned int byteCount;
304 1
305 1 byteCount = 0;
306 1
307 1 tmpPtr = *ptr;
308 1
309 1 while( atInfo.rxHeadPtr != atInfo.rxCurPtr )
310 1 {
311 2 byteCount ++;
312 2 *tmpPtr ++ = *atInfo.rxHeadPtr++;
313 2
314 2 if( atInfo.rxHeadPtr == (char xdata *)0x100 )
315 2 atInfo.rxHeadPtr = (char xdata *)0;
316 2
317 2 }
318 1
319 1 *ptr = tmpPtr;
320 1
321 1 return(byteCount);
322 1 }
323
324 /************************通道B*************************************************/
325 char xdata siobRxBuffer[520];
326
327
328 char siob_send(char *ptr, unsigned int len)
329 {
330 1
331 1 if( siobInfo.txState )
332 1 return -1;
333 1 else
334 1 {
335 2 siobInfo.txState=1;
336 2 siobInfo.txPtr = ptr;
337 2 siobInfo.txLen = len;
338 2 chBTxd = *siobInfo.txPtr ++;
339 2 siobInfo.txLen --;
340 2 while(siobInfo.txState==1);
341 2 return 0;
342 2 }
343 1 }
344
345 void siob_start_receive(void)
346 {
347 1 siobInfo.txTimer = 0;
348 1 siobInfo.rxState = 0;
349 1 siobInfo.rxLen = 0;
350 1 siobInfo.rxCurPtr = siobRxBuffer;
351 1
352 1 }
353
354 unsigned int siob_receive(char **ptr)
355 {
356 1 *ptr = siobRxBuffer;
357 1
358 1 if( siobInfo.rxState == 5 )
359 1 return siobInfo.rxLen;
360 1 else
361 1 return 0;
362 1 }
363
C51 COMPILER V7.09 16C554 09/25/2008 11:56:16 PAGE 7
364 void siob_timeout(void)
365 {
366 1
367 1 if( siobInfo.rxState == 1)
368 1 {
369 2 siobInfo.rxTimer --;
370 2 if( !siobInfo.rxTimer )
371 2 {
372 3 siobInfo.rxState = 5;
373 3 siobInfo.rxTimer = 0;
374 3 }
375 2 }
376 1 else if( siobInfo.rxState != 5 )
377 1 {
378 2 siobInfo.rxState = 0;
379 2 siobInfo.rxLen = 0;
380 2 }
381 1
382 1 }
383
384 /************************通道C*************************************************/
385 char xdata siocRxBuffer[256];
386
387
388 char sioc_send(char *ptr, unsigned int len)
389 {
390 1
391 1 if( siocInfo.txState )
392 1 return -1;
393 1 else
394 1 {
395 2 siocInfo.txState = 1;
396 2 siocInfo.txPtr = ptr;
397 2 siocInfo.txLen = len;
398 2
399 2 chCTxd = *siocInfo.txPtr ++;
400 2 siocInfo.txLen --;
401 2 return 0;
402 2 }
403 1 }
404
405 void sioc_start_receive(void)
406 {
407 1 siocInfo.txTimer = 0;
408 1 siocInfo.rxState = 0;
409 1 siocInfo.rxLen = 0;
410 1 siocInfo.rxCurPtr = siocRxBuffer;
411 1
412 1 }
413
414 char sioc_receive(char **ptr)
415 {
416 1 *ptr = siocRxBuffer;
417 1
418 1 if( siocInfo.rxState == 5 )
419 1 return siocInfo.rxLen;
420 1 else
421 1 return 0;
422 1 }
423
424 void sioc_timeout(void)
425 {
C51 COMPILER V7.09 16C554 09/25/2008 11:56:16 PAGE 8
426 1
427 1 if( siocInfo.rxState == 1)
428 1 {
429 2 siocInfo.rxTimer --;
430 2 if( !siocInfo.rxTimer )
431 2 {
432 3 siocInfo.rxState = 5;
433 3 siocInfo.rxTimer = 0;
434 3 }
435 2 }
436 1 else if( siocInfo.rxState != 5 )
437 1 {
438 2 siocInfo.rxState = 0;
439 2 siocInfo.rxLen = 0;
440 2 }
441 1
442 1 }
443
444 /*****************************其它文件使用的函数**********************************/
445 void tl16c554_init()
446 {
447 1 /**/
448 1 atInfo.rxState = 0;
449 1 atInfo.txState = 0;
450 1 atInfo.rxLen = 0;
451 1 atInfo.txLen = 0;
452 1 atInfo.txTimer = 0;
453 1 atInfo.rxHeadPtr = rxTmpBuffer;
454 1 atInfo.rxCurPtr = atInfo.rxHeadPtr;
455 1 memset(rxTmpBuffer, 0, sizeof(rxTmpBuffer));
456 1
457 1 memset(&siobInfo, 0, sizeof(siobInfo) );
458 1 memset(siobRxBuffer, 0, sizeof(siobRxBuffer) );
459 1 siob_start_receive();
460 1 siobInfo.txTimer = 10;
461 1
462 1 memset(&siocInfo, 0, sizeof(siocInfo) );
463 1 memset(siocRxBuffer, 0, sizeof(siocRxBuffer) );
464 1 sioc_start_receive();
465 1 siocInfo.txTimer = 10;
466 1
467 1 /**/
468 1 chA_init();
469 1 chB_init();
470 1 chC_init();
471 1 chD_init();
472 1
473 1
474 1
475 1
476 1 /*初始化中断1*/
477 1 IT1 = 0; /*为电平触发方式*/
478 1 EX1 = 1;
479 1
480 1 }
481
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1440 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 837 14
C51 COMPILER V7.09 16C554 09/25/2008 11:56:16 PAGE 9
PDATA SIZE = ---- ----
DATA SIZE = 1 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -