📄 uart_int_brg.lst
字号:
C51 COMPILER V7.10 UART_INT_BRG 05/14/2004 11:12:45 PAGE 1
C51 COMPILER V7.10, COMPILATION OF MODULE UART_INT_BRG
OBJECT MODULE PLACED IN uart_int_brg.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE uart_int_brg.c BROWSE DEBUG OBJECTEXTEND TABS(3)
line level source
1 /**
2 * @file $RCSfile: uart_int_brg.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 internal baud rate generator.
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 * internal baud rate generator.
26 * FUNCTION_INPUTS: void
27 * FUNCTION_OUTPUTS: void
28 */
29 void main (void)
30 {
31 1 SCON = 0x50; /* uart in mode 1 (8 bit), REN=1 */
32 1 BDRCON &=0xEC; /* BRR=0; SRC=0; */
33 1 BDRCON |=0x0C; /* TBCK=1;RBCK=1; SPD=0 */
34 1 BRL=0xFD; /* 9600 Bds at 11.059MHz */
35 1 ES = 1; /* Enable serial interrupt */
36 1 EA = 1; /* Enable global interrupt */
37 1 BDRCON |=0x10; /* Baud rate generator run*/
38 1
39 1 while(1); /* endless */
40 1 }
41
42 /**
43 * FUNCTION_PURPOSE: serial interrupt, echo received data.
44 * FUNCTION_INPUTS: P3.0(RXD) serial input
45 * FUNCTION_OUTPUTS: P3.1(TXD) serial output
46 */
47 void serial_IT(void) interrupt 4
48 {
49 1
50 1 if (RI == 1)
51 1 { /* if reception occur */
52 2 RI = 0; /* clear reception flag for next reception */
53 2 uart_data = SBUF; /* Read receive data */
54 2 SBUF = uart_data; /* Send back same data on uart*/
55 2 }
C51 COMPILER V7.10 UART_INT_BRG 05/14/2004 11:12:45 PAGE 2
56 1 else TI = 0; /* if emission occur */
57 1 /* clear emission flag for next emission*/
58 1 }
59
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 36 ----
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 + -