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

📄 main.lis

📁 Button 一个国外大学生毕业设计,用的是AVR单片机
💻 LIS
📖 第 1 页 / 共 4 页
字号:
 0000                   cpu LMM
                        .module main.c
                        .area text(rom, con, rel)
 0000                   .dbfile ./main.c
 0000                   .dbfunc e main _main fV
 0000           _main::
 0000                   .dbline -1
 0000                   .dbline 93
 0000           ; //---------------------------------------------------------------------
 0000           ; // 
 0000           ; //    Name:           CSR_7Button_Demo_v2.1
 0000           ; //                                    - 4/1/06 - version 2.1 (XCH)
 0000           ; //                                                            - removed function call to output 
 0000           ; //                                count values 
 0000           ; //                                                            - added output of CSR_baSwOnMask[0] 
 0000           ; //                                                              to LCD
 0000           ; //                                    - 3/20/06 - version 2.0 (XCH)
 0000           ; //                                                            - added Calibration routine
 0000           ; //                                                        - adjusted settings
 0000           ; //
 0000           ; //  For Board:  CY3212-CapSense RevA 
 0000           ; //    Chip:           CY8C21434-24LFXI
 0000           ; //
 0000           ; //  Description:
 0000           ; //            This code determines which switch is depressed among 7 switches
 0000           ; // and displays that switch number on the LCD display. This project uses 
 0000           ; // Period method of measurement. The display on LCD (port 2 in the LCD UM 
 0000           ; // parameters) will display the value of CSR_baSwOnMask[0].  This variable
 0000           ; // holds the on/off status of the 7 switches as a bitmask.  Then once switch
 0000           ; // is pressed, the switch number is displayed on the LCD display.  The 
 0000           ; // switch numbers and port pins are assigned in UM wizard.
 0000           ; // 
 0000           ; //  Project Settings (in the Device Editor):
 0000           ; //
 0000           ; //            Global Resources:
 0000           ; //                    Power Setting [Vcc/SysClk freq]: 5.0V / 24MHz
 0000           ; //                    CPU_Clock:      SysClk/1
 0000           ; //            
 0000           ; //            User Module Parameters:
 0000           ; //                    Method: Period
 0000           ; //                    FingerThreshold: 100
 0000           ; //                    NoiseThreshold: 40
 0000           ; //                    BaselineUpdateRate: 40 
 0000           ; //                    ESDDebounce: Disabled
 0000           ; //
 0000           ; //  Switch to port settings in CSR wizard (for CY3212 demo board)
 0000           ; //
 0000           ; //  SW0 -> P1[4]
 0000           ; //  SW1 -> P1[6]
 0000           ; //  SW2 -> P3[0]
 0000           ; //  SW3 -> P3[2]
 0000           ; //  SW4 -> P3[3]
 0000           ; //  SW5 -> P3[1]
 0000           ; //  SW6 -> P1[3]
 0000           ; //
 0000           ; //  Notes:
 0000           ; //  CSR_1_baSwOnMask -> is an array of BYTEs that contains the data
 0000           ; //  that determines which button has been pressed.  The first
 0000           ; //  byte CSR_1_baSwOnMask[0] holds the on/off state of the first 8 switches
 0000           ; //  in the system, CSR_1_baSwOnMask[1] would hold the on/off state of the 
 0000           ; //  next 8 switches in the system.  Since there are only 7 switches in
 0000           ; //  this particular system we only use CSR_1_baSwOnMask[0]. 
 0000           ; //  Th LSb (bit 0) represents the state of switch0:
 0000           ; //  0 = off
 0000           ; //  1 = on
 0000           ; //  Bit 1 represents switch1 and so on.
 0000           ; //------------------------------------------------------------------------
 0000           ; #include <m8c.h> // part specific constants and macros
 0000           ; #include "PSoCAPI.h" // PSoC API definitions for all User Modules
 0000           ; 
 0000           ; // bit masks defined for each button
 0000           ; #define BUTTON_0 0x01
 0000           ; #define BUTTON_1 0x02
 0000           ; #define BUTTON_2 0x04
 0000           ; #define BUTTON_3 0x08
 0000           ; #define BUTTON_4 0x10
 0000           ; #define BUTTON_5 0x20
 0000           ; #define BUTTON_6 0x40
 0000           ; 
 0000           ; // define the number of switches in this system
 0000           ; #define NUM_SWITCHES  7
 0000           ; 
 0000           ; // the followin defines the ranges for the raw counts
 0000           ; // during the calibration routines
 0000           ; #define DAC_MAX_RAW_COUNT     310
 0000           ; #define DAC_MIN_RAW_COUNT     290
 0000           ; 
 0000           ; // autocalibration routine
 0000           ; //-----------------------------
 0000           ; //  will automatically determine the DAC settings for each switch in the system
 0000           ; void CalibrateSwitches(void);
 0000           ; 
 0000           ; // Array that holds the individual DAC settings for each switch
 0000           ; BYTE bDACcurrent[NUM_SWITCHES];
 0000           ; 
 0000           ; WORD i,x;
 0000           ; 
 0000           ; // start main
 0000           ; //------------------------------------------------------------------------------------------
 0000           ; void main()
 0000           ; {
 0000                   .dbline 94
 0000           ;       CSR_1_Start();  // call CSR Start, does all the internal CSR connections
 0000 10                push X
 0001 7C0000            xcall _CSR_1_Start
 0004 20                pop X
 0005                   .dbline 95
 0005           ;       M8C_EnableGInt; // Enable global interrupts
 0005 7101                      or  F, 01h
 0007           
 0007                   .dbline 96
 0007           ;       LCD_1_Start();  // Initialize LCD
 0007 10                push X
 0008 7C0000            xcall _LCD_1_Start
 000B 20                pop X
 000C                   .dbline 99
 000C           ;       
 000C           ;       // call the calibrate switches function to initialize the parameter settings
 000C           ;       CalibrateSwitches();
 000C 9295              xcall _CalibrateSwitches
 000E                   .dbline 101
 000E           ;       
 000E           ;     LCD_1_Start();               // Initialize LCD  
 000E 10                push X
 000F 7C0000            xcall _LCD_1_Start
 0012                   .dbline 102
 0012           ;       LCD_1_Position(0,0);
 0012 5000              mov A,0
 0014 5C                mov X,A
 0015 7C0000            xcall _LCD_1_Position
 0018                   .dbline 103
 0018           ;       LCD_1_PrCString("7-Button        ");
 0018 504B              mov A,>L2
 001A 08                push A
 001B 504B              mov A,<L2
 001D 5C                mov X,A
 001E 18                pop A
 001F 7C0000            xcall _LCD_1_PrCString
 0022                   .dbline 104
 0022           ;       LCD_1_Position(1,0);
 0022 5700              mov X,0
 0024 5001              mov A,1
 0026 7C0000            xcall _LCD_1_Position
 0029                   .dbline 105
 0029           ;       LCD_1_PrCString("Demo v2.0       ");
 0029 503A              mov A,>L3
 002B 08                push A
 002C 503A              mov A,<L3
 002E 5C                mov X,A
 002F 18                pop A
 0030 7C0000            xcall _LCD_1_PrCString
 0033 20                pop X
 0034                   .dbline 108
 0034           ; 
 0034           ;       // delay long enough for title and version to be displayed
 0034           ;       for (i=0; i< 60000; i++)
 0034 62D000            mov REG[0xd0],>_i
 0037 550100            mov [_i+1],0
 003A 550000            mov [_i],0
 003D 8029              xjmp L7
 003F           L4:
 003F                   .dbline 109
 003F           ;       {
 003F                   .dbline 110
 003F           ;               for (x=0; x< 20; x++)
 003F 62D000            mov REG[0xd0],>_x
 0042 550100            mov [_x+1],0
 0045 550000            mov [_x],0
 0048 8009              xjmp L11
 004A           L8:
 004A                   .dbline 111
 004A                   .dbline 111
 004A           L9:
 004A                   .dbline 110
 004A 62D000            mov REG[0xd0],>_x
 004D 7601              inc [_x+1]
 004F 0E0000            adc [_x],0
 0052           L11:
 0052                   .dbline 110
 0052 62D000            mov REG[0xd0],>_x
 0055 5101              mov A,[_x+1]
 0057 1114              sub A,20
 0059 5100              mov A,[_x]
 005B 1900              sbb A,0
 005D CFEC              jc L8
 005F           X1:
 005F                   .dbline 112
 005F           L5:
 005F                   .dbline 108
 005F 62D000            mov REG[0xd0],>_i
 0062 7601              inc [_i+1]
 0064 0E0000            adc [_i],0
 0067           L7:
 0067                   .dbline 108
 0067 62D000            mov REG[0xd0],>_i
 006A 5101              mov A,[_i+1]
 006C 62D000            mov REG[0xd0],>__r0
 006F 5300              mov [__r3],A
 0071 62D000            mov REG[0xd0],>_i
 0074 5100              mov A,[_i]
 0076 62D000            mov REG[0xd0],>__r0
 0079 5300              mov [__r2],A
 007B 5100              mov A,[__r3]
 007D 1160              sub A,96
 007F 5100              mov A,[__r2]
 0081 19EA              sbb A,-22
 0083 5000              mov A,0
 0085 1900              sbb A,0
 0087 5000              mov A,0
 0089 3180              xor A,-128
 008B 1980              sbb A,(0 ^ 0x80)
 008D CFB1              jc L4
 008F           X2:
 008F                   .dbline 114
 008F           ;               {}
 008F           ;       }
 008F           ;       
 008F           ;       LCD_1_Position(0,0);
 008F 10                push X
 0090 5000              mov A,0
 0092 5C                mov X,A
 0093 7C0000            xcall _LCD_1_Position
 0096                   .dbline 115
 0096           ;       LCD_1_PrCString("                ");
 0096 5029              mov A,>L12
 0098 08                push A
 0099 5029              mov A,<L12
 009B 5C                mov X,A
 009C 18                pop A
 009D 7C0000            xcall _LCD_1_PrCString
 00A0                   .dbline 116
 00A0           ;       LCD_1_Position(1,0);
 00A0 5700              mov X,0
 00A2 5001              mov A,1
 00A4 7C0000            xcall _LCD_1_Position
 00A7                   .dbline 117
 00A7           ;       LCD_1_PrCString("                ");
 00A7 5029              mov A,>L12
 00A9 08                push A
 00AA 5029              mov A,<L12
 00AC 5C                mov X,A
 00AD 18                pop A
 00AE 7C0000            xcall _LCD_1_PrCString
 00B1 20                pop X
 00B2 81EC              xjmp L14
 00B4           L13:
 00B4                   .dbline 120
 00B4           ;       
 00B4           ;       while(1) // start the main loop
 00B4           ;       {
 00B4                   .dbline 122
 00B4           ;               // scan each switch individually
 00B4           ;               for (i=0; i<NUM_SWITCHES; i++)
 00B4 62D000            mov REG[0xd0],>_i
 00B7 550100            mov [_i+1],0
 00BA 550000            mov [_i],0
 00BD 8054              xjmp L19
 00BF           L16:
 00BF                   .dbline 123
 00BF           ;               {
 00BF                   .dbline 124
 00BF           ;                       CSR_1_SetDacCurrent(bDACcurrent[i],0); // Sets DAC current
 00BF 10                push X
 00C0 5000              mov A,0
 00C2 08                push A
 00C3 62D000            mov REG[0xd0],>_i
 00C6 5101              mov A,[_i+1]

⌨️ 快捷键说明

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