📄 serial.lst
字号:
C51 COMPILER V7.06 SERIAL 01/13/2008 14:49:16 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE SERIAL
OBJECT MODULE PLACED IN serial.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE serial.C LARGE BROWSE INCDIR(E:\操作系统\UC-OS\UCOS8051-可用\) DEBUG OBJECT
-EXTEND
stmt level source
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 *
6 * (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
7 * All Rights Reserved
8 *
9 * V2.00
10 *
11 * File : serial.C
12 * 功能: 基于中断的串口驱动及显示程序
13 *********************************************************************************************************
14 */
15
16 #ifndef OS_MASTER_FILE
17 #include "includes.h"
18 #endif
19
20 #include <serial.h>
21 unsigned char TxBuf[LenTxBuf],RxBuf[LenRxBuf]; //收发缓冲区
22 unsigned char inTxBuf,outTxBuf,inRxBuf,outRxBuf;//收发缓冲区读写指针
23 bit TIflag=1; //发送区空标志
24
25 void InitSerial() reentrant //串口初始化,9600,8bit,1bit stop
26 {
27 1 TMOD=TMOD&0x0F;
28 1 TMOD=TMOD|0x20;
29 1 TH1=0xFD;
30 1 TL1=0xFD;
31 1 SCON=0x50;
32 1 PCON=0x00;
33 1 TR1=1;
34 1 }
35
36 void InitSerialBuffer(void) reentrant //串口缓冲区初始化
37 {
38 1 inTxBuf=outTxBuf=0;
39 1 inRxBuf=outRxBuf=0;
40 1 ES=1;
41 1 }
42
43 void serial(void) reentrant
44 {
45 1 if(TI){
46 2 TI=0;
47 2 while(inTxBuf!=outTxBuf){
48 3 SBUF=TxBuf[outTxBuf];
49 3 while(TI==0);
50 3 TI=0;
51 3 outTxBuf=(outTxBuf+1)%LenTxBuf;
52 3 }
53 2 TIflag=1;
54 2 }
C51 COMPILER V7.06 SERIAL 01/13/2008 14:49:16 PAGE 2
55 1 if(RI){
56 2 RI=0;
57 2 if(((inRxBuf+1)%LenTxBuf)==outRxBuf) return;
58 2 RxBuf[inRxBuf]=SBUF;
59 2 inRxBuf=(inRxBuf+1)%LenTxBuf;
60 2 }
61 1 }
62
63 void PrintChar(unsigned char ch) reentrant
64 {
65 1 if(((inTxBuf+1)%LenTxBuf)==outTxBuf) return;
66 1 TxBuf[inTxBuf]=ch;
67 1 inTxBuf=(inTxBuf+1)%LenTxBuf;
68 1 if(TIflag){
69 2 TIflag=0;
70 2 TI=1;
71 2 }
72 1 }
73
74 void PrintStr(unsigned char *str) reentrant
75 {
76 1 int i;
77 1 unsigned char ch;
78 1 OS_ENTER_CRITICAL();
79 1 for(i=0;i<MaxLenStr;i++){
80 2 ch=*(str+i);
81 2 if(ch=='\0') break;
82 2 else if(ch=='\n'){
83 3 PrintChar('\n');
84 3 PrintChar('\r');
85 3 }
86 2 else
87 2 PrintChar(ch);
88 2 }
89 1 OS_EXIT_CRITICAL();
90 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 369 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 2054 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -