📄 uart_t1.lst
字号:
C51 COMPILER V7.10 UART_T1 04/23/2004 09:46:52 PAGE 1
C51 COMPILER V7.10, COMPILATION OF MODULE UART_T1
OBJECT MODULE PLACED IN uart_t1.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE uart_t1.c BROWSE DEBUG OBJECTEXTEND TABS(3)
line level source
1 /**
2 * @file $RCSfile: uart_t1.c,v $
3 *
4 * Copyright (c) 2004 Atmel.
5 *
6 * Please read file license.txt for copyright notice.
7 *
8 * @brief This file is an example to use uart with timer1.
9 *
10 * This file can be parsed by Doxygen for automatic documentation
11 * generation.
12 * Put here the functional description of this file within the software
13 * architecture of your program.
14 *
15 * @version $Revision: 1.0 $ $Name: $
16 */
17
18 /* @section I N C L U D E S */
19 #include "reg_c51.h"
20
21 char uart_data;
22
23 /**
24 * FUNCTION_PURPOSE: This file set up uart in mode 1 (8 bits uart) with
25 * timer 1 in mode 2 (8 bits auto reload timer).
26 * FUNCTION_INPUTS: void
27 * FUNCTION_OUTPUTS: void
28 */
29 void main (void)
30 {
31 1 PCON |= 0x80;
32 1 SCON = 0x50; /* uart in mode 1 (8 bit), REN=1 */
33 1 TMOD = TMOD | 0x20 ; /* Timer 1 in mode 2 */
34 1 TH1 = 0xF3; /* 9600 Bds at 11.059MHz */
35 1 TL1 = 0xF3; /* 9600 Bds at 11.059MHz */
36 1 ES = 1; /* Enable serial interrupt */
37 1 EA = 1; /* Enable global interrupt */
38 1 TR1 = 1; /* Timer 1 run */
39 1
40 1 while(1); /* endless */
41 1 }
42
43 /**
44 * FUNCTION_PURPOSE: serial interrupt, echo received data.
45 * FUNCTION_INPUTS: P3.0(RXD) serial input
46 * FUNCTION_OUTPUTS: P3.1(TXD) serial output
47 */
48 void serial_IT(void) interrupt 4
49 {
50 1
51 1 if (RI == 1)
52 1 { /* if reception occur */
53 2 RI = 0; /* clear reception flag for next reception */
54 2 uart_data = SBUF; /* Read receive data */
55 2 SBUF = uart_data; /* Send back same data on uart*/
C51 COMPILER V7.10 UART_T1 04/23/2004 09:46:52 PAGE 2
56 2 }
57 1 else
58 1 { /* if emission occur */
59 2 TI = 0; /* clear emission flag for next emission*/
60 2 }
61 1 }
62
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 38 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
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 + -