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

📄 main.lis

📁 AVR单片机系统开发经典实例部分源程序
💻 LIS
📖 第 1 页 / 共 5 页
字号:
                        .module main.c
                        .area text(rom, con, rel)
 0000                   .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\main.c
 0000                   .dbfunc e SendDetails _SendDetails fV
 0000           ;              w -> R20,R21
                        .even
 0000           _SendDetails::
 0000 0E940000          xcall push_gset1
 0004 2497              sbiw R28,4
 0006                   .dbline -1
 0006                   .dbline 70
 0006           ; // This program tests the ppp routine and shows how to use it
 0006           ; 
 0006           ; /*
 0006           ;  * Copyright (C) 2003-2004 by Clive Moss All rights reserved.
 0006           ;  *
 0006           ;  * Help & Contributions from D.J.Armstrong
 0006           ; 
 0006           ;  * Redistribution and use in source and binary forms, with or without
 0006           ;  * modification, are permitted provided that the following conditions
 0006           ;  * are met:
 0006           ;  *
 0006           ;  * 1. Redistributions of source code must retain the above copyright
 0006           ;  *    notice, this list of conditions and the following disclaimer.
 0006           ;  * 2. Redistributions in binary form must reproduce the above copyright
 0006           ;  *    notice, this list of conditions and the following disclaimer in the
 0006           ;  *    documentation and/or other materials provided with the distribution.
 0006           ;  * 3. Neither the name of the copyright holders nor the names of
 0006           ;  *    contributors may be used to endorse or promote products derived
 0006           ;  *    from this software without specific prior written permission.
 0006           ;  *
 0006           ;  * THIS SOFTWARE IS PROVIDED BY CLIVE MOSS 'AS IS' AND ANY EXPRESS OR
 0006           ;  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 0006           ;  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 0006           ;  * ARE DISCLAIMED.
 0006           ;  * IN NO EVENT SHALL CLIVE MOSS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 0006           ;  * INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 0006           ;  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 0006           ;  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 0006           ;  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 0006           ;  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
 0006           ;  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 0006           ;  * SUCH DAMAGE.
 0006           ;  */
 0006           ; 
 0006           ;  //#ifdef CPU_eZ8
 0006           ; //    #pragma stkck                                                                   // enable stack checking
 0006           ; //#endif
 0006           ; 
 0006           ; #include "common.h"
 0006           ; 
 0006           ; #ifdef CPU_eZ8
 0006           ;       #include <eZ8.h>
 0006           ; #endif
 0006           ; 
 0006           ; #ifdef CPU_ATmega128
 0006           ;       #include <iom128v.h>
 0006           ;       #include <macros.h>
 0006           ; #endif
 0006           ; 
 0006           ; #include <stdio.h>
 0006           ; #include <string.h>
 0006           ; #include <stdlib.h>
 0006           ; #include <ctype.h>
 0006           ; //#include <spi.h>
 0006           ; 
 0006           ; #include "main.h"
 0006           ; #include "common.h"
 0006           ; #include "fcs.h"
 0006           ; #include "at.h"
 0006           ; #include "ppp.h"
 0006           ; #include "ip.h"
 0006           ; 
 0006           ; #ifdef IncludeTCP
 0006           ; #include "tcp.h"
 0006           ; #endif
 0006           ; 
 0006           ; // *********************************************************************************
 0006           ; 
 0006           ; void SendDetails(void)
 0006           ; {
 0006                   .dbline 73
 0006           ;       u16     w;
 0006           ; 
 0006           ;       if (!SendConsoleRStr(Str3)) return;
 0006 00E0              ldi R16,<_Str3
 0008 10E0              ldi R17,>_Str3
 000A 0E940000          xcall _SendConsoleRStr
 000E 0023              tst R16
 0010 09F4              brne L2
 0012                   .dbline 73
 0012 C9C0              xjmp L1
 0014           L2:
 0014                   .dbline 75
 0014           ; 
 0014           ;       if (!SendConsoleRStr(VersionStr)) return;
 0014 00E0              ldi R16,<_VersionStr
 0016 10E0              ldi R17,>_VersionStr
 0018 0E940000          xcall _SendConsoleRStr
 001C 0023              tst R16
 001E 09F4              brne L4
 0020                   .dbline 75
 0020 C2C0              xjmp L1
 0022           L4:
 0022                   .dbline 76
 0022           ;       sprintf((char*)ScratchPad, "%u.%02x\n", Version >> 8, Version & 0xff);
 0022 E0E0              ldi R30,<_Version
 0024 F0E0              ldi R31,>_Version
 0026 0590              lpm R0,Z+
 0028 1490              lpm R1,Z
 002A F001              movw R30,R0
 002C F070              andi R31,0
 002E FB83              std y+3,R31
 0030 EA83              std y+2,R30
 0032 E0E0              ldi R30,<_Version
 0034 F0E0              ldi R31,>_Version
 0036 0590              lpm R0,Z+
 0038 1490              lpm R1,Z
 003A F001              movw R30,R0
 003C EF2F              mov R30,R31
 003E FF27              clr R31
 0040 F983              std y+1,R31
 0042 E883              std y+0,R30
 0044 20E0              ldi R18,<L6
 0046 30E0              ldi R19,>L6
 0048 00E0              ldi R16,<_ScratchPad
 004A 10E0              ldi R17,>_ScratchPad
 004C 0E940000          xcall _sprintf
 0050                   .dbline 77
 0050           ;       if (!SendConsoleStr((char*)ScratchPad)) return;
 0050 00E0              ldi R16,<_ScratchPad
 0052 10E0              ldi R17,>_ScratchPad
 0054 0E940000          xcall _SendConsoleStr
 0058 0023              tst R16
 005A 09F4              brne L7
 005C                   .dbline 77
 005C A4C0              xjmp L1
 005E           L7:
 005E                   .dbline 79
 005E           ; 
 005E           ;       if (!SendConsoleRStr(Title)) return;
 005E 00E0              ldi R16,<_Title
 0060 10E0              ldi R17,>_Title
 0062 0E940000          xcall _SendConsoleRStr
 0066 0023              tst R16
 0068 09F4              brne L9
 006A                   .dbline 79
 006A 9DC0              xjmp L1
 006C           L9:
 006C                   .dbline 80
 006C           ;       if (!SendConsoleRStr(Date)) return;
 006C 00E0              ldi R16,<_Date
 006E 10E0              ldi R17,>_Date
 0070 0E940000          xcall _SendConsoleRStr
 0074 0023              tst R16
 0076 09F4              brne L11
 0078                   .dbline 80
 0078 96C0              xjmp L1
 007A           L11:
 007A                   .dbline 85
 007A           ; 
 007A           ;    // ************
 007A           ; 
 007A           ;       #ifdef CPU_ATmega128
 007A           ;       if (!SendConsoleStr("\nUnit ID: ")) return;
 007A 00E0              ldi R16,<L15
 007C 10E0              ldi R17,>L15
 007E 0E940000          xcall _SendConsoleStr
 0082 0023              tst R16
 0084 09F4              brne L13
 0086                   .dbline 85
 0086 8FC0              xjmp L1
 0088           L13:
 0088                   .dbline 86
 0088           ;       if (Get_UnitID((char*)ScratchPad))
 0088 00E0              ldi R16,<_ScratchPad
 008A 10E0              ldi R17,>_ScratchPad
 008C 0E940000          xcall _Get_UnitID
 0090 0023              tst R16
 0092 71F0              breq L16
 0094                   .dbline 87
 0094           ;       {
 0094                   .dbline 88
 0094           ;               if (!SendConsoleStr(ScratchPad)) return;
 0094 00E0              ldi R16,<_ScratchPad
 0096 10E0              ldi R17,>_ScratchPad
 0098 0E940000          xcall _SendConsoleStr
 009C 0023              tst R16
 009E 09F4              brne L18
 00A0                   .dbline 88
 00A0 82C0              xjmp L1
 00A2           L18:
 00A2                   .dbline 89
 00A2           ;               if (!SendConsoleStr("\n")) return;
 00A2 00E0              ldi R16,<L22
 00A4 10E0              ldi R17,>L22
 00A6 0E940000          xcall _SendConsoleStr
 00AA 0023              tst R16
 00AC 41F4              brne L17
 00AE                   .dbline 89
 00AE 7BC0              xjmp L1
 00B0           X0:
 00B0                   .dbline 90
 00B0           ;       }
 00B0           L16:
 00B0                   .dbline 92
 00B0           ;       else
 00B0           ;       {
 00B0                   .dbline 93
 00B0           ;               if (!SendConsoleStr("Invalid\n")) return;
 00B0 00E0              ldi R16,<L25
 00B2 10E0              ldi R17,>L25
 00B4 0E940000          xcall _SendConsoleStr
 00B8 0023              tst R16
 00BA 09F4              brne L23
 00BC                   .dbline 93
 00BC 74C0              xjmp L1
 00BE           L23:
 00BE                   .dbline 94
 00BE           ;       }
 00BE           L17:
 00BE                   .dbline 99
 00BE           ;       #endif
 00BE           ; 
 00BE           ;    // ************
 00BE           ; 
 00BE           ;       sprintf((char*)ScratchPad, "\nLast reset reason: %02X", LastResetReason);
 00BE 20900000          lds R2,_LastResetReason
 00C2 3324              clr R3
 00C4 3982              std y+1,R3
 00C6 2882              std y+0,R2
 00C8 20E0              ldi R18,<L26
 00CA 30E0              ldi R19,>L26
 00CC 00E0              ldi R16,<_ScratchPad
 00CE 10E0              ldi R17,>_ScratchPad
 00D0 0E940000          xcall _sprintf
 00D4                   .dbline 109
 00D4           ; 
 00D4           ;       #ifdef CPU_eZ8
 00D4           ;       if (LastResetReason & 0x80) strcat((char*)ScratchPad, " POR");
 00D4           ;       if (LastResetReason & 0x40) strcat((char*)ScratchPad, " STOP");
 00D4           ;       if (LastResetReason & 0x20) strcat((char*)ScratchPad, " WD");
 00D4           ;       if (LastResetReason & 0x10) strcat((char*)ScratchPad, " EXT");
 00D4           ;       #endif
 00D4           ; 
 00D4           ;       #ifdef CPU_ATmega128
 00D4           ;       if (LastResetReason & 0x10) strcat((char*)ScratchPad, " JTAG");
 00D4 20900000          lds R2,_LastResetReason
 00D8 24FE              sbrs R2,4
 00DA 06C0              rjmp L27
 00DC                   .dbline 109
 00DC 20E0              ldi R18,<L29
 00DE 30E0              ldi R19,>L29
 00E0 00E0              ldi R16,<_ScratchPad
 00E2 10E0              ldi R17,>_ScratchPad
 00E4 0E940000          xcall _strcat
 00E8           L27:
 00E8                   .dbline 110
 00E8           ;       if (LastResetReason & 0x08) strcat((char*)ScratchPad, " WD");
 00E8 20900000          lds R2,_LastResetReason
 00EC 23FE              sbrs R2,3
 00EE 06C0              rjmp L30
 00F0                   .dbline 110
 00F0 20E0              ldi R18,<L32
 00F2 30E0              ldi R19,>L32
 00F4 00E0              ldi R16,<_ScratchPad
 00F6 10E0              ldi R17,>_ScratchPad
 00F8 0E940000          xcall _strcat
 00FC           L30:
 00FC                   .dbline 111
 00FC           ;       if (LastResetReason & 0x04) strcat((char*)ScratchPad, " BRN-OUT");
 00FC 20900000          lds R2,_LastResetReason
 0100 22FE              sbrs R2,2
 0102 06C0              rjmp L33
 0104                   .dbline 111
 0104 20E0              ldi R18,<L35
 0106 30E0              ldi R19,>L35

⌨️ 快捷键说明

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