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

📄 cpld_read.lis

📁 用ICC编写的程序包括SPI
💻 LIS
字号:
                        .module Cpld_Read.c
                        .area text(rom, con, rel)
 0000                   .dbfile F:\IccAvr_Pro\Cpld_Read.c
 0000                   .dbfunc e Cpld_Read _Cpld_Read fI
 0000           ;           temp -> R22
 0000           ;         Result -> R20,R21
 0000           ;        Address -> R16
                        .even
 0000           _Cpld_Read::
 0000 0E940000          xcall push_gset2
 0004                   .dbline -1
 0004                   .dbline 5
 0004           ; #include "Cpld_Read.h"
 0004           ; #include <macros.h>
 0004           ; 
 0004           ; int Cpld_Read(unsigned char Address)
 0004           ; {
 0004                   .dbline 9
 0004           ;   
 0004           ;   unsigned char temp;
 0004           ;   int          Result;
 0004           ;   CLI();
 0004 F894              cli
 0006                   .dbline 10
 0006           ;   if(Address)                                                 //Address select
 0006 0023              tst R16
 0008 11F0              breq L2
 000A                   .dbline 11
 000A           ;       PORTB|=BIT(A0);                 
 000A C39A              sbi 0x18,3
 000C 01C0              xjmp L3
 000E           L2:
 000E                   .dbline 13
 000E           ;   else
 000E           ;       PORTB&=~BIT(A0);
 000E C398              cbi 0x18,3
 0010           L3:
 0010                   .dbline 14
 0010           ;   PORTB|=BIT(LoadL);                                  //LoadL set low
 0010 C19A              sbi 0x18,1
 0012                   .dbline 15
 0012           ;   NOP();
 0012 0000              nop
 0014                   .dbline 16
 0014           ;   NOP();
 0014 0000              nop
 0016                   .dbline 17
 0016           ;   PORTB&=~BIT(LoadL);                                 
 0016 C198              cbi 0x18,1
 0018                   .dbline 18
 0018           ;   NOP();
 0018 0000              nop
 001A                   .dbline 19
 001A           ;   NOP();
 001A 0000              nop
 001C                   .dbline 20
 001C           ;   NOP();
 001C 0000              nop
 001E                   .dbline 21
 001E           ;   temp=CpldRead;                                              //Read Data low byte
 001E 69B3              in R22,0x19
 0020                   .dbline 22
 0020           ;   temp=CpldRead;
 0020 69B3              in R22,0x19
 0022                   .dbline 24
 0022           ;   
 0022           ;   PORTB|=BIT(LoadL);                                  //Set LoadL high
 0022 C19A              sbi 0x18,1
 0024                   .dbline 26
 0024           ;   
 0024           ;   PORTB|=BIT(LoadH);                                  //LoadH set low
 0024 C09A              sbi 0x18,0
 0026                   .dbline 27
 0026           ;   NOP();
 0026 0000              nop
 0028                   .dbline 28
 0028           ;   NOP();
 0028 0000              nop
 002A                   .dbline 29
 002A           ;   PORTB&=~BIT(LoadH);                                 
 002A C098              cbi 0x18,0
 002C                   .dbline 30
 002C           ;   NOP();
 002C 0000              nop
 002E                   .dbline 31
 002E           ;   NOP();
 002E 0000              nop
 0030                   .dbline 32
 0030           ;   NOP();
 0030 0000              nop
 0032                   .dbline 33
 0032           ;   Result=CpldRead;                                            //Read Data low byte
 0032 49B3              in R20,0x19
 0034 5527              clr R21
 0036                   .dbline 34
 0036           ;   Result=CpldRead;
 0036 49B3              in R20,0x19
 0038 5527              clr R21
 003A                   .dbline 36
 003A           ;   
 003A           ;   PORTB|=BIT(LoadH);                                  //LoadH set high
 003A C09A              sbi 0x18,0
 003C                   .dbline 38
 003C           ;   
 003C           ;  Result=(Result<<8)+temp;
 003C 542F              mov R21,R20
 003E 462F              mov R20,R22
 0040                   .dbline 39
 0040           ;  SEI();
 0040 7894              sei
 0042                   .dbline 41
 0042           ;  
 0042           ;  return        Result;
 0042 8A01              movw R16,R20
 0044                   .dbline -2
 0044           L1:
 0044 0E940000          xcall pop_gset2
 0048                   .dbline 0 ; func end
 0048 0895              ret
 004A                   .dbsym r temp 22 c
 004A                   .dbsym r Result 20 I
 004A                   .dbsym r Address 16 c
 004A                   .dbend
 004A                   .dbfunc e Cpld_Set _Cpld_Set fV
                        .even
 004A           _Cpld_Set::
 004A                   .dbline -1
 004A                   .dbline 46
 004A           ;  
 004A           ;  }
 004A           ;  
 004A           ;  void  Cpld_Set(void)
 004A           ;  {
 004A                   .dbline 47
 004A           ;       CLI();                                                          //Set all the counters reset 
 004A F894              cli
 004C                   .dbline 48
 004C           ;       PORTB|=BIT(Set);                                        //Zero
 004C C29A              sbi 0x18,2
 004E                   .dbline 49
 004E           ;       NOP();
 004E 0000              nop
 0050                   .dbline 50
 0050           ;       NOP();
 0050 0000              nop
 0052                   .dbline 51
 0052           ;       PORTB&=~BIT(Set);
 0052 C298              cbi 0x18,2
 0054                   .dbline 52
 0054           ;       NOP();
 0054 0000              nop
 0056                   .dbline 53
 0056           ;       NOP();
 0056 0000              nop
 0058                   .dbline 54
 0058           ;       NOP();
 0058 0000              nop
 005A                   .dbline 55
 005A           ;       NOP();
 005A 0000              nop
 005C                   .dbline 56
 005C           ;       NOP();
 005C 0000              nop
 005E                   .dbline 57
 005E           ;       NOP();
 005E 0000              nop
 0060                   .dbline 58
 0060           ;       PORTB|=BIT(Set);
 0060 C29A              sbi 0x18,2
 0062                   .dbline 59
 0062           ;       SEI();
 0062 7894              sei
 0064                   .dbline -2
 0064           L4:
 0064                   .dbline 0 ; func end
 0064 0895              ret
 0066                   .dbend
 0066                   .dbfunc e Cpld_Init _Cpld_Init fV
                        .even
 0066           _Cpld_Init::
 0066                   .dbline -1
 0066                   .dbline 63
 0066           ; }
 0066           ; 
 0066           ; void  Cpld_Init(void)
 0066           ; {       
 0066                   .dbline 64
 0066           ;  PORTB|=BIT(Set);                                             //Set All Control signal high
 0066 C29A              sbi 0x18,2
 0068                   .dbline 65
 0068           ;  PORTB|=BIT(LoadL);
 0068 C19A              sbi 0x18,1
 006A                   .dbline 66
 006A           ;  PORTB|=BIT(LoadH);
 006A C09A              sbi 0x18,0
 006C                   .dbline 67
 006C           ;  PORTB&=~BIT(LoadL);
 006C C198              cbi 0x18,1
 006E                   .dbline -2
 006E           L5:
 006E                   .dbline 0 ; func end
 006E 0895              ret
 0070                   .dbend

⌨️ 快捷键说明

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