📄 serial.lst
字号:
ARM COMPILER V0.12, Serial 08/10/04 13:08:54 PAGE 1
ARM COMPILER V0.12, COMPILATION OF MODULE Serial
OBJECT MODULE PLACED IN .\Flash\Serial.obj
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe Serial.c THUMB OPTIMIZE(7,SPEED) BROWSE DEBUG PRINT(.\FLASH\SERIAL.LST) TABS
-(4) OBJECT(.\Flash\Serial.obj)
stmt level source
1 /******************************************************************************/
2 /* This file is part of the uVision/ARM development tools */
3 /* Copyright KEIL ELEKTRONIK GmbH 2002-2004 */
4 /******************************************************************************/
5 /* */
6 /* SERIAL.C: Low Level Serial Routines */
7 /* */
8 /******************************************************************************/
9
10 #include <LPC21xx.H> /* LPC21xx definitions */
11 #include <stdio.h> /* standard I/O .h-file */
12
13 #define CR 0x0D
14
15 void sendhex (int hex) { /* Write Hex Digit to Serial Port */
16 1 if (hex > 9) putchar('A' + (hex - 10));
17 1 else putchar('0' + hex);
18 1 }
19
20 void sendstr (char *p) { /* Write string */
21 1 while (*p) {
22 2 putchar (*p++);
23 2 }
24 1 }
25
26
27 void init_serial (void) { /* Initialize Serial Interface */
28 1
29 1 PINSEL0 = 0x05; /* Select TxD and RxD on pin connect block */
30 1 U0LCR = 0x80; /* Enable programming of divisor latches */
31 1
32 1 U0DLL = 0x61; /* Program the divisor latch for 19200 baud */
33 1 U0DLM = 0x00;
34 1
35 1 U0LCR = 0x33; /* Program the line control 8\N\1 */
36 1 }
37
38
39 int putchar (int ch) { /* Write character to Serial Port */
40 1
41 1 if (ch == '\n') {
42 2 while (!(U0LSR & 0x20));
43 2 U1THR = CR; /* output CR */
44 2 }
45 1 while (!(U0LSR & 0x20));
46 1 return (U0THR = ch);
47 1 }
48
49
50 int getchar (void) { /* Read character from Serial Port */
51 1
52 1 while (!(U0LSR & 0x01));
53 1
54 1 return (U0RBR);
55 1 }
56
ARM COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -