⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modbus.lst

📁 液晶显示
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V7.50   MODBUS                                                                11/17/2007 15:15:44 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE MODBUS
OBJECT MODULE PLACED IN MODBUS.OBJ
COMPILER INVOKED BY: e:\Keil\C51\BIN\C51.EXE MODBUS.c LARGE BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg52.h>
   2          #include <intrins.h>
   3          #include <string.h>
   4          
   5          
   6          
   7          //*****************************类型定义******************************************
   8          
   9          typedef                 unsigned char                           uchar;
  10          typedef                 signed char                                     schar;
  11          typedef                 unsigned int                            uint;
  12          typedef                 signed int                                      sint;
  13          typedef                 unsigned long                           ulong;
  14          typedef                 signed long                                     slong;
  15          typedef                 float                                           fb;
  16          typedef                 double                                          db;
  17          
  18          
  19          //******************************主程序循环事件***********************************
  20          
  21          #define                 SYSTEM_EVENT            0x01
  22          #define                         MAIN_EVENT                      0x02
  23          #define                         DISPLAY_EVENT           0x03
  24          #define                         KEY_EVENT                       0x04
  25          #define                         UART_EVENT                      0x05
  26          #define                         ALARM_EVENT                     0x06
  27          #define                         HANDLE_EVENT            0x07
  28          
  29          
  30          //****************************LCD循环事件******************************************
  31          
  32          #define                 MUNE_LCD                        0x01
  33          #define                 CHANNEL_LCD                     0x02
  34          #define                 ALARM_LCD                       0x03
  35          #define                 LANG_LCD                        0x04
  36          #define                 CHECK_LCD                       0x05
  37          #define                 SYSTEM_LCD                      0x06
  38          #define                 LOCK_LCD                        0x07
  39          
  40          #define                 INPUT_TYPE                      0x08
  41          #define                 INPUT_UNIT                      0x09
  42          #define                 PROG_DOWN                       0x0a
  43          #define                 PROG_UP                         0x0b
  44          #define                 SIGNAL_HANDLE           0x0c
  45          
  46          #define                 ALARM_TYPE                      0x10
  47          #define                 ALARM_UP                        0x11
  48          #define                 UP_RETURN                       0x12
  49          #define                 ALARM_DOWN                      0x13
  50          #define                 DOWN_RETURN                     0x14
  51          
  52          #define                         MANY_CALI                       0x20
  53          #define                         ONE_CALI                        0x21
  54          #define                         TWO_CALI                        0x22
  55          #define                         THREE_CALI                      0x23
C51 COMPILER V7.50   MODBUS                                                                11/17/2007 15:15:44 PAGE 2   

  56          #define                         FOUR_CALI                       0x24
  57          #define                         FIVE_CALI                       0x25
  58          #define                         SAX_CALI                        0x26
  59          #define                         SEVEN_CALI                      0x27
  60          #define                         EIGHT_CALI                      0x28
  61          #define                         NINE_CALI                       0x29
  62          
  63          #define                         PASSWORD                        0x30    
  64          #define                         DIVCE_ADDR                      0x31
  65          #define                         UART_BAUD                       0x32
  66          #define                         CHANGE_TIME                     0x33
  67          #define                         UART_PROC                       0x34
  68          #define                         SHORT_ALARM                     0x35
  69          
  70          #define                 DOT_LCD                         0x0d
  71          #define                         OPEN_LOCK                       0x50
  72          
  73          
  74          
  75          #define                         TIMER_HIGHT                             0xd8                                             // 定时器10MS
  76          #define                         TIMER_LOW                               0xef
  77          
  78          
  79          //char xdata                    LcmPort                         _at_            0x4000;               //  液晶使能              
  80          char xdata                      HandlePort                      _at_            0x4000;                   //  采集使能
  81          char xdata                      ExternPort              _at_            0x6000;                           //  外部输入使能
  82          char xdata                      LedPort                         _at_            0x8000;                   //  LED输出使能
  83          char xdata              LcdPort                         _at_            0xc000;                           //  都不使能对液晶操作
  84          char xdata                      Cs_Port                         _at_            0xf800;                           //  LCD全使能
  85          char xdata                      Cs1_Port                        _at_            0xe800;                           //  CS1 使能
  86          char xdata                      Cs2_Port                        _at_            0xf000;                           //  CS2 使能
  87          
  88          
  89          //#define                       LcmEnable                       LcmPort 
  90          #define                         HandleEnable            HandlePort
  91          #define                         ExternEnable            ExternPort      
  92          #define                         LedEnable                       LedPort
  93          #define                         LcdEnable                       LcdPort
  94          #define                         Cs_Enable                       Cs_Port
  95          #define                         Cs1_Enable                      Cs1_Port
  96          #define                         Cs2_Enable                      Cs2_Port
  97          
  98          //****************************LCD状态定义*********************************************
  99          
 100          #define                         DisplayOn                       0x3f                                 //  显示开
 101          #define                         DisplayOff                      0x3e                                                     //  显示关
 102          #define                         YsetAdress                      0x40                                                     //  Y地址设定
 103          #define                         XsetAdress                      0xb8                                                     //  X地址设定
 104          #define                         LineAdress                      0xc0                                                     //  行地址设定
 105          #define             ReadBusy                    0x80                                                     //  读数据忙
 106          #define             ReadDispOff                 0x20                                                     //  读显示关
 107          #define             ReadReset                   0x10                                                     //  读复位
 108          #define                         ReadStatus                      0x80                                                     //  读状态位
 109          #define                         WriteData                       0x10                                                     //  写数据
 110          #define                         ReadData                        0x90                                                     //  读数据
 111          
 112          
 113          
 114          //****************************LCD的操作********************************************
 115          
 116          #define                         LCD_CS2_BIT             0x01                                                    //  CS2 使能
 117          #define                         LCD_CS1_BIT             0x02                                                    //  CS1 使能
C51 COMPILER V7.50   MODBUS                                                                11/17/2007 15:15:44 PAGE 3   

 118          #define                         LCD_RW_BIT              0x80                                                    //  R/W 使能
 119          #define                         LCD_DI_BIT              0x10                                                    //  D/I 使能
 120          
 121          #define                         READ_STATUS                     0x01                                                    //  读状态
 122          #define                         READ_DATA                       0x11                                                    //  读显示数据
 123          #define                         WRITE_DATA                      0x10                                                    //  写显示数据
 124          #define                         WRITE_CMD                       0x00                                                    //  写指令
 125          
 126          
 127          //#define                               LCD_READ_STATUS         LcmEnable = READ_STATUS                 //  读状态
 128          //#define                               LCD_READ_DATA           LcmEnable = READ_DATA               //  读显示数据
 129          //#define                               LCD_WRITE_DATA          LcmEnable = WRITE_DATA                  //  写显示数据
 130          //#define                               LCD_WRITE_CMD       LcmEnable = WRITE_CMD                       //  写指令
 131          
 132          
 133          
 134          #define                         HADLE_CLK                       0x08
 135          #define                         HANDLE_CHANGE           0x04
 136          #define                         SEND                            0x10
 137          #define                         AL_L                            0x20
 138          #define                         AL_H                            0x40
 139          #define                         GZ_A                            0x80
 140          #define                         ADC                             0x01
 141          
 142          
 143          #define                         ALARM_L                                 HandleEnable =(alarm_uart_data | 0x20 )
 144          #define                         NOALARM_L                               HandleEnable =(alarm_uart_data & 0xdf )
 145          #define                         ALARM_H                                 HandleEnable =(alarm_uart_data | 0x40 )
 146          #define                         NOALARM_H                               HandleEnable =(alarm_uart_data & 0xbf )
 147          #define                         ALARM_A                                 HandleEnable =(alarm_uart_data | 0x80 )
 148          #define                         NOALARM_A                               HandleEnable =(alarm_uart_data & 0x7f )
 149          #define                         SEND_485                                HandleEnable =(alarm_uart_data | 0x10 )
 150          #define                         RECEIVE_485                             HandleEnable =(alarm_uart_data & 0xef )
 151          #define                         ADC_DATA_START                  HandleEnable =(alarm_uart_data & 0xfe )
 152          #define                         ADC_DATA_STOP                   HandleEnable =(alarm_uart_data | 0x01 )
 153          
 154          
 155          #define                         ALL_DATA_VAL            492
 156          #define                         FIRST_DATA                      64
 157          #define                         ALL_DATA                        30
 158          #define                         ADC_A_H                         3000

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -