?? uart.lst
字號:
C51 COMPILER V7.50 UART 12/13/2005 13:14:02 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE UART
OBJECT MODULE PLACED IN .\OBJ\uart.obj
COMPILER INVOKED BY: c:\Program Files\C51\BIN\C51.EXE C\uart.c BROWSE DEBUG OBJECTEXTEND PRINT(.\LST\uart.lst) OBJECT(.\
-OBJ\uart.obj)
line level source
1 /*------------------------------------------------------------------------------
2 ; This file is part of the RLC instruction
3 ; Copyright (c)
4 ; Version: 1.0
5 ;-------------------------------------------------------------------------------
6 ; Filename:
7 ; main.c
8 ; Function:
9 ;
10 ; Author:
11 ; pirate
12 ;
13 ; Writedate:
14 ; Oct.15 2005
15 ; Moddate(latest):
16 ; Oct.15 2005
17 ;-------------------------------------------------------------------------------
18 */
19
20 //--------------------------------------
21 // Included files
22 //--------------------------------------
23 #include <reg52.h>
24 #include ".\HEAD\dtype.h"
25 #include ".\HEAD\externf.h"
26 #include ".\HEAD\sdefine.h"
27
28 //--------------------------------------
29 // Local Definitions and Types
30 //--------------------------------------
31
32
33
34 /*******************************************************************************
35 //*
36 //*! Function: UART_init
37 //*!
38 //*! Description:
39 //*! - initialize the UART communiction modle
40 //*!
41 //*! Inputs: None
42 //*!
43 //*! Returns: None
44 //*
45 /*******************************************************************************
46 /*/
47 /*
48 void Uart_init(void)
49 {
50 TMOD = 0x20; //apply timer1 to generate baud rate
51 SCON = 0x50; //UART modle 1
52 PCON = 0x00; //single baud rate
53 TH1 = 0xFD; //baude rate = 9600bps @11.0592MHz
54 TL1 = 0xFD;
C51 COMPILER V7.50 UART 12/13/2005 13:14:02 PAGE 2
55 } */
56
57 /*******************************************************************************
58 //*
59 //*! Function: CalBaudrate
60 //*!
61 //*! Description:
62 //*! - by changing the value of TH1 & TL1 to find initiate value
63 //*! of timer2
64 //*!
65 //*! Inputs: None
66 //*!
67 //*! Returns: None
68 //*
69 /*******************************************************************************
70 /*/
71 void CalBaudrate(uchar inival)
72 {
73 1 T2CON = 0x30; //use timer2 to generate baudrate, and permitted it to receive data
74 1 //TMOD = 0x20; //apply timer1 to generate baud rate
75 1 SCON = 0x50;
76 1 //PCON = 0x00; //double baud rate
77 1 TH2 = 0xFF;
78 1 TL2 = inival;
79 1 RCAP2H = 0xFF;
80 1 RCAP2L = inival;
81 1 //TH1 = inival;
82 1 //TL1 = inival;
83 1 }
84
85 /*******************************************************************************
86 //*
87 //*! Function: UART_send char
88 //*!
89 //*! Description:
90 //*! - A newdata can write into the SBUF of the UART, then it is
91 //*! transfered to a destination soon.
92 //*!
93 //*! Inputs: newdata
94 //*!
95 //*! Returns: none
96 //*
97 /*******************************************************************************
98 /*/
99 void UartSendChar(uchar dat)
100 {
101 1 TI = 0; //clear Transmition symbol
102 1 SBUF = dat;
103 1 for(;;)
104 1 {
105 2 if(TI)
106 2 break;
107 2 else
108 2 ;
109 2 }
110 1 TI = 0;
111 1 }
112
113 /*******************************************************************************
114 //*
115 //*! Function: UART_receive char
116 //*!
C51 COMPILER V7.50 UART 12/13/2005 13:14:02 PAGE 3
117 //*! Description:
118 //*! - This function can receive a char using the SBUF of UART from
119 //*! RXD pin of AP180
120 //*!
121 //*! Inputs: None
122 //*!
123 //*! Returns: newdata
124 //*
125 /*******************************************************************************
126 /*/
127 uchar UartReceiveChar(void)
128 {
129 1 uchar z;
130 1 RI = 0;
131 1 for(;;)
132 1 {
133 2 if(RI)
134 2 break;
135 2 else
136 2 ;
137 2 }
138 1 z = SBUF;
139 1 RI = 0;
140 1 return(z);
141 1 }
142
143
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 37 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
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 + -