📄 pc_io_in.lst
字号:
C51 COMPILER V6.10 PC_IO_IN 04/18/2001 16:09:39 PAGE 1
C51 COMPILER V6.10, COMPILATION OF MODULE PC_IO_IN
OBJECT MODULE PLACED IN .\PC_IO_in.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE .\PC_IO_in.c OPTIMIZE(6,SIZE) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /*------------------------------------------------------------------*-
2
3 PC_IN_in.C (v1.01)
4
5 ------------------------------------------------------------------
6
7 PC link library. Bidirectional. c515,517 etc - internal baud rate.
8
9 Uses the USART, and Pins 3.1 (Tx) and 3.0 (Rx)
10
11 See text for details.
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 "PC_IO_in.h"
30
31 // ------ Public variable declarations -----------------------------
32
33 extern tByte In_read_index_G;
34 extern tByte In_waiting_index_G;
35
36 extern tByte Out_written_index_G;
37 extern tByte Out_waiting_index_G;
38
39 /*------------------------------------------------------------------*-
40
41 PC_LINK_Init_Internal()
42
43 This version uses internal baud rate generator on C5x5 family.
44
45 -*------------------------------------------------------------------*/
46 void PC_LINK_IO_Init_Internal(const tWord BAUD_RATE)
47 {
48 1 tWord SRELplus1024;
49 1 tWord SRELx;
50 1
51 1 PCON &= 0x7F; // Set SMOD bit to 0 (don't double baud rates)
52 1
53 1 // Receiver enabled.
54 1 // 8-bit data, 1 start bit, 1 stop bit,
55 1 // Variable baud rate (asynchronous)
C51 COMPILER V6.10 PC_IO_IN 04/18/2001 16:09:39 PAGE 2
56 1 // Receive flag will only be set if a valid stop bit is received
57 1 // Set TI (transmit buffer is empty)
58 1 SCON = 0x72;
59 1
60 1 // Use the internal baudrate generator (80c5x5 family)
61 1 ADCON0 |= 0x80;
62 1
63 1 // Set the baud rate (begin)
64 1 SRELplus1024 = (tWord)((((tLong) OSC_FREQ / 100) * 3125)
65 1 / ((tLong) BAUD_RATE * 1000));
66 1
67 1 SRELx = 1024 - SRELplus1024;
68 1
69 1 SRELL = (tByte)(SRELx & 0x00FF);
70 1 SRELH = (tByte)((SRELx & 0x0300) >> 8);
71 1
72 1 TI = 1;
73 1 // Set the baud rate (end)
74 1
75 1 // Set up the buffers for reading and writing
76 1 In_read_index_G = 0;
77 1 In_waiting_index_G = 0;
78 1 Out_written_index_G = 0;
79 1 Out_waiting_index_G = 0;
80 1
81 1 PC_LINK_IO_Write_String_To_Buffer("Serial OK\n");
82 1
83 1 // Serial interrupt *NOT* enabled
84 1 ES = 0;
85 1 }
86
87 /*------------------------------------------------------------------*-
88 ---- END OF FILE -------------------------------------------------
89 -*------------------------------------------------------------------*/
90
91
92
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 79 ----
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 + -