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

📄 comm.lis

📁 一个正在应用的步进电机控制程序,包括电机的调速,正反,细分,通讯控制
💻 LIS
📖 第 1 页 / 共 5 页
字号:
                        .module comm.c
                        .area data(ram, con, rel)
                        .area vector(rom, abs)
                        .org 44
 002C 0C947600          jmp _serialri_int
                        .area data(ram, con, rel)
                        .area vector(rom, abs)
                        .org 52
 0034 0C940000          jmp _serialti_int
                        .area data(ram, con, rel)
                        .area text(rom, con, rel)
 0000                   .dbfile C:\BJQD\comm.c
 0000                   .dbfunc e serialti_int _serialti_int fV
 0000           ;              i -> <dead>
                        .even
 0000           _serialti_int::
 0000 2A92              st -y,R2
 0002 3A92              st -y,R3
 0004 8A93              st -y,R24
 0006 9A93              st -y,R25
 0008 EA93              st -y,R30
 000A FA93              st -y,R31
 000C 2FB6              in R2,0x3f
 000E 2A92              st -y,R2
 0010                   .dbline -1
 0010                   .dbline 88
 0010           ; /*******************************************************
 0010           ; /*ICC-AVR application builder : 2004-3-11 12:02:11
 0010           ; // Target : atMega16
 0010           ; // Crystal: 8.0000Mhz
 0010           ; 通讯模块  单工双向485接口
 0010           ; ******************************************************/
 0010           ; #include <string.h>
 0010           ; #include <iom16v.h>
 0010           ; #include <math.h>
 0010           ; #include <stdlib.h>
 0010           ; #include <macros.h>
 0010           ; #include <eeprom.h>
 0010           ; #include "eeprom_l.h"
 0010           ; #include "comm.h"
 0010           ; #include "main.h"
 0010           ; #include "delay.h"
 0010           ; #include "key.h"
 0010           ;        
 0010           ; #pragma data:data
 0010           ; unsigned char state2;
 0010           ; //state2.0 disable_data    //1:输入数据无效,0有效;
 0010           ; //state2.1 remote                //1:遥控输入有效,0:本地输入有效
 0010           ; //state2.7 p99                           //P99指令使能
 0010           ; unsigned char state1;                                                                                   
 0010           ; //state1.2 PE  
 0010           ; //state1.3 DOR
 0010           ; //state1.4 FE
 0010           ; //state1.5 
 0010           ; //state1.6 
 0010           ; unsigned char pump_tab;               //机器号                                                                   
 0010           ; extern unsigned int speed;
 0010           ; extern unsigned char state_other;
 0010           ; extern unsigned char state0;
 0010           ; extern unsigned char key;
 0010           ; extern unsigned char in_out_number;
 0010           ; extern unsigned char state;
 0010           ; //state0.5接收消息有效标志
 0010           ; 
 0010           ; /* 通信变量定义 */
 0010           ; char txd_frm[15];         //物理层发送缓冲区
 0010           ; char txd_frm_len;          //物理层发送数据长度
 0010           ; char rxd_frm[15];         //物理层接收缓冲区
 0010           ; char rxd_frm_len;          //物理层接收数据长度
 0010           ; char tx485_busy;                 //485发送工作判忙
 0010           ; char txd_cnt;                    //发送数据计数器
 0010           ; char rxd_cnt;                    //接收数据计数器
 0010           ; char rxd_ins_flag;               //一帧接收数据中有E8或E9标志
 0010           ; char txd_ins_flag;               //一帧发送数据中有E8或E9标志
 0010           ; char txd_ins_data;               //发送数据
 0010           ; char rxd_data;                           //接收数据
 0010           ; char mac_txd_th;                 //发送状态 0发送完毕,1发送帧头,2发送中间数据
 0010           ; char rxd_h_ok;                           //接收开始标志
 0010           ; char fcs1;                               //异或校验
 0010           ; char rxd_mesg_addr;              //接收地址
 0010           ; char rxd_mesg_len;               //应用层接收数据长度
 0010           ; char rxd_mesg[15];               //应用层接收数据缓冲区
 0010           ; char txd_mesg_addr;              //发送地址
 0010           ; char txd_mesg_len;               //应用层发送数据长度
 0010           ; char txd_mesg[15];               //应用层发送数据缓冲区
 0010           ; /*********任务管理*************/
 0010           ; char pri[16];
 0010           ; char act[16];           //任务寄存器
 0010           ; char rxd_llc_job;       //物理层收任务寄存器
 0010           ; char txd_llc_job;       //物理层发任务寄存器
 0010           ; char rs485_app_job;     //应用层任务寄存器
 0010           ; char att_n_max;
 0010           ; extern struct cal
 0010           ;        {
 0010           ;          unsigned  int       test_time;
 0010           ;          unsigned  long int  dispvol;
 0010           ;          unsigned  long int  test_dispvol;
 0010           ;          float               dispk;
 0010           ;          unsigned  long int  run_time;
 0010           ;          };
 0010           ; extern struct cal cal0;
 0010           ; /*****************************************************************
 0010           ; 功能: serial_int
 0010           ; 描述: 运行串行口 FSAs.
 0010           ; 参数: 无.
 0010           ; 返回无.
 0010           ; 影响无.
 0010           ; *****************************************************************/
 0010           ; #pragma interrupt_handler serialri_int:iv_USART_RX
 0010           ; #pragma interrupt_handler serialti_int:iv_USART_TX
 0010           ; 
 0010           ; /* 通信物理层发送中断程序模块 */
 0010           ; void serialti_int(void)
 0010           ; { 
 0010                   .dbline 90
 0010           ;       char i;
 0010           ;           UCSRA=RS485_UCSRA|0b01000000;   /*清发送完中断标志位*/
 0010 80E4              ldi R24,64
 0012 8BB9              out 0xb,R24
 0014                   .dbline 91
 0014           ;               if(mac_txd_th==1)
 0014 80914800          lds R24,_mac_txd_th
 0018 8130              cpi R24,1
 001A 71F4              brne L2
 001C                   .dbline 92
 001C           ;               { UDR=0xe9;
 001C                   .dbline 92
 001C 89EE              ldi R24,233
 001E 8CB9              out 0xc,R24
 0020                   .dbline 93
 0020           ;                 txd_cnt=0;
 0020 2224              clr R2
 0022 20924E00          sts _txd_cnt,R2
 0026                   .dbline 94
 0026           ;                 txd_ins_flag=0;
 0026 20924B00          sts _txd_ins_flag,R2
 002A                   .dbline 95
 002A           ;                 tx485_busy=1;
 002A 81E0              ldi R24,1
 002C 80934F00          sts _tx485_busy,R24
 0030                   .dbline 96
 0030           ;                 mac_txd_th=2;
 0030 82E0              ldi R24,2
 0032 80934800          sts _mac_txd_th,R24
 0036                   .dbline 97
 0036           ;               }
 0036 51C0              xjmp L3
 0038           L2:
 0038                   .dbline 99
 0038           ;               else
 0038           ;               { if(mac_txd_th==2)
 0038                   .dbline 99
 0038 80914800          lds R24,_mac_txd_th
 003C 8230              cpi R24,2
 003E 09F0              breq X0
 0040 46C0              xjmp L4
 0042           X0:
 0042                   .dbline 100
 0042           ;                 { if(txd_ins_flag==1)
 0042                   .dbline 100
 0042 80914B00          lds R24,_txd_ins_flag
 0046 8130              cpi R24,1
 0048 39F4              brne L6
 004A                   .dbline 101
 004A           ;                   { txd_ins_flag=0;
 004A                   .dbline 101
 004A 2224              clr R2
 004C 20924B00          sts _txd_ins_flag,R2
 0050                   .dbline 102
 0050           ;                         UDR=txd_ins_data;
 0050 20904A00          lds R2,_txd_ins_data
 0054 2CB8              out 0xc,R2
 0056                   .dbline 103
 0056           ;                       }
 0056 41C0              xjmp L5
 0058           L6:
 0058                   .dbline 105
 0058           ;                       else
 0058           ;                       { if(txd_cnt<=(txd_frm_len-1))
 0058                   .dbline 105
 0058 80916000          lds R24,_txd_frm_len
 005C 8150              subi R24,1
 005E 20904E00          lds R2,_txd_cnt
 0062 8215              cp R24,R2
 0064 68F1              brlo L8
 0066                   .dbline 106
 0066           ;                         { if(txd_frm[txd_cnt]==0xe8||txd_frm[txd_cnt]==0xe9)
 0066                   .dbline 106
 0066 80E0              ldi R24,<_txd_frm
 0068 90E0              ldi R25,>_txd_frm
 006A E22D              mov R30,R2
 006C FF27              clr R31
 006E E80F              add R30,R24
 0070 F91F              adc R31,R25
 0072 2080              ldd R2,z+0
 0074 3324              clr R3
 0076 822D              mov R24,R2
 0078 883E              cpi R24,232
 007A 11F0              breq L12
 007C 893E              cpi R24,233
 007E 89F4              brne L10
 0080           L12:
 0080                   .dbline 107
 0080           ;                           { txd_ins_flag=1;
 0080                   .dbline 107
 0080 81E0              ldi R24,1
 0082 80934B00          sts _txd_ins_flag,R24
 0086                   .dbline 108
 0086           ;                   txd_ins_data=txd_frm[txd_cnt]-0xe8;
 0086 80E0              ldi R24,<_txd_frm
 0088 90E0              ldi R25,>_txd_frm
 008A E0914E00          lds R30,_txd_cnt
 008E FF27              clr R31
 0090 E80F              add R30,R24
 0092 F91F              adc R31,R25
 0094 8081              ldd R24,z+0
 0096 885E              subi R24,232
 0098 80934A00          sts _txd_ins_data,R24
 009C                   .dbline 109
 009C           ;                   UDR=0xe8;
 009C 88EE              ldi R24,232
 009E 8CB9              out 0xc,R24
 00A0                   .dbline 110
 00A0           ;                               }
 00A0 09C0              xjmp L11
 00A2           L10:
 00A2                   .dbline 112
 00A2           ;                               else
 00A2           ;                               { UDR=txd_frm[txd_cnt];}
 00A2                   .dbline 112
 00A2 80E0              ldi R24,<_txd_frm
 00A4 90E0              ldi R25,>_txd_frm
 00A6 E0914E00          lds R30,_txd_cnt
 00AA FF27              clr R31
 00AC E80F              add R30,R24
 00AE F91F              adc R31,R25
 00B0 2080              ldd R2,z+0
 00B2 2CB8              out 0xc,R2
 00B4                   .dbline 112
 00B4           L11:
 00B4                   .dbline 113
 00B4           ;                               txd_cnt=txd_cnt+1;
 00B4 80914E00          lds R24,_txd_cnt
 00B8 8F5F              subi R24,255    ; addi 1
 00BA 80934E00          sts _txd_cnt,R24
 00BE                   .dbline 114
 00BE           ;                         }
 00BE 0DC0              xjmp L5
 00C0           L8:
 00C0                   .dbline 116
 00C0           ;                         else
 00C0           ;                         { tx485_busy=0;
 00C0                   .dbline 116
 00C0 2224              clr R2
 00C2 20924F00          sts _tx485_busy,R2
 00C6                   .dbline 117
 00C6           ;                           mac_txd_th=0;
 00C6 20924800          sts _mac_txd_th,R2
 00CA                   .dbline 118
 00CA           ;                               PORTC&=~(1<<DE_485);
 00CA A898              cbi 0x15,0
 00CC                   .dbline 119
 00CC           ;                         }
 00CC                   .dbline 120
 00CC           ;                       }
 00CC                   .dbline 121
 00CC           ;                 }
 00CC 06C0              xjmp L5
 00CE           L4:
 00CE                   .dbline 123
 00CE           ;                 else
 00CE           ;                 { tx485_busy=0;
 00CE                   .dbline 123
 00CE 2224              clr R2
 00D0 20924F00          sts _tx485_busy,R2
 00D4                   .dbline 124
 00D4           ;                   mac_txd_th=0;
 00D4 20924800          sts _mac_txd_th,R2
 00D8                   .dbline 125
 00D8           ;                       PORTC&=~(1<<DE_485);
 00D8 A898              cbi 0x15,0
 00DA                   .dbline 126
 00DA           ;                 }
 00DA           L5:
 00DA                   .dbline 127
 00DA           L3:
 00DA                   .dbline -2
 00DA           L1:
 00DA 2990              ld R2,y+
 00DC 2FBE              out 0x3f,R2
 00DE F991              ld R31,y+
 00E0 E991              ld R30,y+
 00E2 9991              ld R25,y+
 00E4 8991              ld R24,y+
 00E6 3990              ld R3,y+
 00E8 2990              ld R2,y+
 00EA                   .dbline 0 ; func end
 00EA 1895              reti
 00EC                   .dbsym l i 1 c
 00EC                   .dbend
 00EC                   .dbfunc e serialri_int _serialri_int fV
 00EC           ;              i -> <dead>
                        .even
 00EC           _serialri_int::
 00EC 2A92              st -y,R2
 00EE 3A92              st -y,R3
 00F0 4A92              st -y,R4
 00F2 5A92              st -y,R5
 00F4 8A93              st -y,R24
 00F6 9A93              st -y,R25
 00F8 EA93              st -y,R30
 00FA FA93              st -y,R31
 00FC 2FB6              in R2,0x3f
 00FE 2A92              st -y,R2
 0100                   .dbline -1
 0100                   .dbline 132
 0100           ;               }
 0100           ; }
 0100           ; 
 0100           ; /* 通信物理层接收中断程序模块 */
 0100           ; void serialri_int(void)
 0100           ; {
 0100                   .dbline 134
 0100           ;       char i;

⌨️ 快捷键说明

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