📄 rs485.lst
字号:
C51 COMPILER V7.10 RS485 11/18/2006 21:15:26 PAGE 1
C51 COMPILER V7.10, COMPILATION OF MODULE RS485
OBJECT MODULE PLACED IN RS485.OBJ
COMPILER INVOKED BY: d:\Program Files\Keil\C51\BIN\C51.EXE RS485.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /*********************************************************************************************************
2 **
3 ** (c) Copyright 2004-2006
4 ** All Rights Reserved
5 **
6 **
7 ** 版权所有:朗顿科技
8 ** http://www.ldmcu.com
9 **
10 ********************************************************************************************************/
11
12 #include <REG52.H> /* special function register declarations */
13 /* for the intended 8051 derivative */
14
15 #include <stdio.h> /* prototype declarations for I/O functions */
16
17 bit senenb = 0;
18 int i_aT,i_bT;
19 unsigned char Tem;
20
21 sbit rs485_com = P3^2;
22 /*------------------------------------------------
23 The main C function. Program execution starts
24 here after stack initialization.
25 ------------------------------------------------*/
26 void delay(unsigned char i);
27
28 void ser_int (void) interrupt 4 using 1
29 {
30 1 if(TI == 1)
31 1 {
32 2 TI = 0;
33 2 senenb = 0;
34 2 }
35 1
36 1 if(RI == 1)
37 1 {
38 2 RI = 0;
39 2 Tem = SBUF;
40 2 senenb = 1;
41 2
42 2 }
43 1 }
44 void main (void) {
45 1
46 1 /*------------------------------------------------
47 1 Setup the serial port for 9600 baud at 11.0592MHz.
48 1 ------------------------------------------------*/
49 1 #ifndef MONITOR51
50 1 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
51 1 TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
52 1 TH1 = 0xfd; /* TH1: reload value for 9600 baud at 11.0592MHz */
53 1 TR1 = 1; /* TR1: timer 1 run */
54 1 IE = 0x90; /* IE: enable UART interrupter */
55 1 #endif
C51 COMPILER V7.10 RS485 11/18/2006 21:15:26 PAGE 2
56 1
57 1 /*------------------------------------------------
58 1 Note that an embedded program never exits (because
59 1 there is no operating system to return to). It
60 1 must loop and execute forever.
61 1 ------------------------------------------------*/
62 1 rs485_com = 0;
63 1
64 1 while(1)
65 1 {
66 2 if(senenb == 1)
67 2 {
68 3 rs485_com = 1;
69 3 SBUF = Tem;
70 3 delay(100);
71 3 }
72 2 else
73 2 {
74 3 rs485_com = 0;
75 3 }
76 2 }
77 1 }
78
79 void delay(unsigned char i)
80 {
81 1 unsigned char j;
82 1 for(i; i > 0; i--)
83 1 for(j = 200; j > 0; j--);
84 1 }
85
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 67 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 5 ----
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -