📄 pc_o_t1.lst
字号:
C51 COMPILER V6.10 PC_O_T1 04/19/2001 11:40:07 PAGE 1
C51 COMPILER V6.10, COMPILATION OF MODULE PC_O_T1
OBJECT MODULE PLACED IN .\PC_O_T1.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE .\PC_O_T1.c OPTIMIZE(6,SIZE) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /*------------------------------------------------------------------*-
2
3 PC_O_A.C (v1.01)
4
5 ------------------------------------------------------------------
6
7 Simple write-only PC link library Version A (generic)
8 [Sends data to PC - cannot receive data from PC]
9
10 Uses the USART, and Pin 3.1 (Tx)
11
12 See text for details (Chapter 18).
13
14
15 COPYRIGHT
16 ---------
17
18 This code is from the book:
19
20 PATTERNS FOR TIME-TRIGGERED EMBEDDED SYSTEMS by Michael J. Pont
21 [Pearson Education, 2001; ISBN: 0-201-33138-1].
22
23 This code is copyright (c) 2001 by Michael J. Pont.
24
25 See book for copyright details and other information.
26
27 -*------------------------------------------------------------------*/
28
29 #include "Main.h"
30 #include "PC_O_T1.h"
31
32 // ------ Public variable declarations -----------------------------
33
34 extern tByte Out_written_index_G;
35 extern tByte Out_waiting_index_G;
36
37 /*------------------------------------------------------------------*-
38
39 PC_LINK_O_Init_T1()
40
41 This version uses T1 for baud rate generation.
42
43 Uses 8051 (internal) UART hardware
44
45 -*------------------------------------------------------------------*/
46 void PC_LINK_O_Init_T1(const tWord BAUD_RATE)
47 {
48 1 PCON &= 0x7F; // Set SMOD bit to 0 (don't double baud rates)
49 1
50 1 // Receiver disabled
51 1 // 8-bit data, 1 start bit, 1 stop bit, variable baud rate (asynchronous)
52 1 SCON = 0x42;
53 1
54 1 TMOD |= 0x20; // T1 in mode 2, 8-bit auto reload
55 1
C51 COMPILER V6.10 PC_O_T1 04/19/2001 11:40:07 PAGE 2
56 1 TH1 = (256 - (tByte)((((tLong)OSC_FREQ / 100) * 3125)
57 1 / ((tLong) BAUD_RATE * OSC_PER_INST * 1000)));
58 1
59 1 TL1 = TH1;
60 1 TR1 = 1; // Run the timer
61 1 TI = 1; // Send first character (dummy)
62 1
63 1 // Set up the buffers for reading and writing
64 1 Out_written_index_G = 0;
65 1 Out_waiting_index_G = 0;
66 1
67 1 PC_LINK_O_Write_String_To_Buffer("Serial OK\n");
68 1
69 1 // Interrupt *NOT* enabled
70 1 ES = 0;
71 1 }
72
73 /*------------------------------------------------------------------*-
74 ---- END OF FILE -------------------------------------------------
75 -*------------------------------------------------------------------*/
76
77
78
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 69 ----
CONSTANT SIZE = 11 ----
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 + -