📄 printf51.lst
字号:
C51 COMPILER V6.10 PRINTF51 04/19/2001 11:30:48 PAGE 1
C51 COMPILER V6.10, COMPILATION OF MODULE PRINTF51
OBJECT MODULE PLACED IN .\PRINTF51.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE .\PRINTF51.C OPTIMIZE(6,SPEED) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /*------------------------------------------------------------------*-
2
3 Printf51.C (v1.00)
4
5 ------------------------------------------------------------------
6
7 A simple serial initialisation routine to allow Keil hardware
8 simulator to be used to run 'desktop' C examples.
9
10 [Full details of a complete serial interface library are given
11 in Chapter 18. This code is for demo purposes only!!! ]
12
13
14 COPYRIGHT
15 ---------
16
17 This code is from the book:
18
19 PATTERNS FOR TIME-TRIGGERED EMBEDDED SYSTEMS by Michael J. Pont
20 [Pearson Education, 2001; ISBN: 0-201-33138-1].
21
22 This code is copyright (c) 2001 by Michael J. Pont.
23
24 See book for copyright details and other information.
25
26 -*------------------------------------------------------------------*/
27
28 #include "Main.h"
29 #include "Printf51.h"
30
31 /*------------------------------------------------------------------*-
32
33 Printf51_Init()
34
35 A simple serial initialisation routine to allow Keil hardware
36 simulator to be used to run 'desktop' C examples.
37
38 -*------------------------------------------------------------------*/
39 void Printf51_Init(void)
40 {
41 1 const tWord BAUD_RATE = 9600;
42 1
43 1 PCON &= 0x7F; // Set SMOD bit to 0 (don't double baud rates)
44 1
45 1 // Receiver enabled.
46 1 // 8-bit data, 1 start bit, 1 stop bit,
47 1 // Variable baud rate (asynchronous)
48 1 // Receive flag will only be set if a valid stop bit is received
49 1 // Set TI (transmit buffer is empty)
50 1 SCON = 0x72;
51 1
52 1 TMOD |= 0x20; // T1 in mode 2, 8-bit auto reload
53 1
54 1 // See Main.H for details of OSC_FREQ and OSC_PER_INST
55 1 TH1 = (256 - (tByte)((((tLong)OSC_FREQ / 100) * 3125)
C51 COMPILER V6.10 PRINTF51 04/19/2001 11:30:48 PAGE 2
56 1 / ((tLong) BAUD_RATE * OSC_PER_INST * 1000)));
57 1
58 1 TL1 = TH1;
59 1 TR1 = 1; // Run the timer
60 1
61 1 TI = 1; // Send dummy byte
62 1
63 1 // Interrupt *NOT* enabled
64 1 ES = 0;
65 1 }
66
67 /*------------------------------------------------------------------*-
68 ---- END OF FILE -------------------------------------------------
69 -*------------------------------------------------------------------*/
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 59 ----
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 + -