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

📄 cc1000avr.lis

📁 CC1000通信
💻 LIS
📖 第 1 页 / 共 5 页
字号:
                        .module cc1000avr.c
                        .area text(rom, con, rel)
 0000                   .dbfile D:\FZCCC\cc1000avr.c
 0000                   .dbfunc e delaycc _delaycc fV
 0000           ;              i -> R20,R21
 0000           ;              j -> R22,R23
 0000           ;              t -> R16,R17
                        .even
 0000           _delaycc::
 0000 0E940000          xcall push_gset2
 0004                   .dbline -1
 0004                   .dbline 94
 0004           ; /****************************************************************************/
 0004           ; /* Application note AN009                                                   */
 0004           ; /* CC1000 interface library                                                 */
 0004           ; /*                                                                          */
 0004           ; /* File:      cc1000avr.c                                                   */
 0004           ; /* Revision:  2.1                                                           */
 0004           ; /*                                                                          */
 0004           ; /* Microcontroller:                                                         */
 0004           ; /*          Atmel AVRmega8L                                                 */
 0004           ; /* Written for the IAR AVR compiler                                         */
 0004           ; /*                                                                          */
 0004           ; /* Author:  Karl H. Torvmark, Field Applications Engineer, Chipcon          */
 0004           ; /*                                                                          */
 0004           ; /* Contact: Chipcon AS +47 22 95 85 44                                      */
 0004           ; /*          wireless@chipcon.com                                            */
 0004           ; /*                                                                          */
 0004           ; /* Changes:                                                                 */
 0004           ; /*      2.1 : First AVR version                                             */
 0004           ; /****************************************************************************/
 0004           ; 
 0004           ; /****************************************************************************/
 0004           ; /* This library contains functions for configuring the CC1000. These        */
 0004           ; /* routines use bit-banging to program the CC1000.                          */
 0004           ; /* Routines to read and write the calibration values in the CC1000 are      */
 0004           ; /* provided, they aree useful in frequency-agile and frequency hopping      */
 0004           ; /* applications. See application note AN009 for more information.           */
 0004           ; /* The routines in this file will have to be adapted depending on the MCU   */
 0004           ; /* and compiler used.                                                       */
 0004           ; /****************************************************************************/
 0004           ; 
 0004           ; /*                                                                           *
 0004           ;  * Revision history:                                                         *
 0004           ;  *                                                                           *
 0004           ;  * $Log: cc1000avr.c,v $
 0004           ;  * Revision 2.5  2003/05/08 10:51:52  tos
 0004           ;  * Corrected LOCK monitor in Calibrate.
 0004           ;  *
 0004           ;  * Revision 2.4  2003/05/08 10:05:26  tos
 0004           ;  * Corrections according to Errata Note 01: reset freq.synth if unable to lock PLL.
 0004           ;  *
 0004           ;  * Revision 2.3  2003/04/28 08:21:14  tos
 0004           ;  * Corrected inconsistent monitoring of CC1000: [calibration complete] + [lock].
 0004           ;  *
 0004           ;  *
 0004           ;  *                                                                           *
 0004           ;  ****************************************************************************/
 0004           ; 
 0004           ; #include "CC1000.h"
 0004           ; #include "iom128v.h"
 0004           ; #include <stdio.h>
 0004           ; 
 0004           ; /* Pin usage definitions */
 0004           ; /*#define PDATA       2   
 0004           ; // PORTB, pin 2
 0004           ; #define PCLK        1   
 0004           ; // PORTB, pin 1
 0004           ; #define PALE        6   
 0004           ; // PORTA, pin 6
 0004           ; #define DIO         6   
 0004           ; // PORTE, pin 6
 0004           ; #define DCLK        6   
 0004           ; // PORTB, pin 6
 0004           ; /**/
 0004           ; #define PDATA       3   // PORTD, pin 3
 0004           ; #define PCLK        4   // PORTD, pin 4
 0004           ; #define PALE        5   // PORTD, pin 5
 0004           ; #define DIO         1   // PORTD, pin 1
 0004           ; #define DCLK        2   // PORTD, pin 2
 0004           ; 
 0004           ; #define CAL_TIMEOUT   0x7FFE
 0004           ; //0x9C40   
 0004           ; #define LOCK_TIMEOUT  0x7FFE
 0004           ; //0xC0
 0004           ; //原先为0x7FFE
 0004           ; /* Contents of CURRENT register for TX and RX, use SmartRF(R) Studio */
 0004           ; /* to find values for your application */   
 0004           ;  
 0004           ; #define TX_CURRENT 0xF3
 0004           ; #define RX_CURRENT 0x8C
 0004           ; 
 0004           ; /* Contents of PLL register for TX and RX, use SmartRF(R) Studio */
 0004           ; /* to find values for your application */
 0004           ; 
 0004           ; #define TX_PLL 0x18
 0004           ; #define RX_PLL 0x18
 0004           ; 
 0004           ; #define PA_VALUE 0xF0  
 0004           ; ///????0x90
 0004           ; 
 0004           ; 
 0004           ; 
 0004           ; /////////////////////////////XIAO YU 修改/////////////////////////
 0004           ; void delaycc(int t)
 0004           ;      {
 0004                   .dbline 96
 0004           ;         int i,j;
 0004           ;         for(i = 0;i < t;i++)
 0004 4427              clr R20
 0006 5527              clr R21
 0008 0AC0              xjmp L5
 000A           L2:
 000A                   .dbline 97
 000A 6627              clr R22
 000C 7727              clr R23
 000E 02C0              xjmp L9
 0010           L6:
 0010                   .dbline 97
 0010           L7:
 0010                   .dbline 97
 0010 6F5F              subi R22,255  ; offset = 1
 0012 7F4F              sbci R23,255
 0014           L9:
 0014                   .dbline 97
 0014 6017              cp R22,R16
 0016 7107              cpc R23,R17
 0018 DCF3              brlt L6
 001A           L3:
 001A                   .dbline 96
 001A 4F5F              subi R20,255  ; offset = 1
 001C 5F4F              sbci R21,255
 001E           L5:
 001E                   .dbline 96
 001E 4017              cp R20,R16
 0020 5107              cpc R21,R17
 0022 9CF3              brlt L2
 0024                   .dbline -2
 0024           L1:
 0024 0E940000          xcall pop_gset2
 0028                   .dbline 0 ; func end
 0028 0895              ret
 002A                   .dbsym r i 20 I
 002A                   .dbsym r j 22 I
 002A                   .dbsym r t 16 I
 002A                   .dbend
 002A                   .dbfunc e ConfigureCC1000 _ConfigureCC1000 fV
 002A           ;    WordCounter -> R20
 002A           ;     BitCounter -> R10
 002A           ;           Data -> R22,R23
 002A           ;  Configuration -> R18,R19
 002A           ;          Count -> R16
                        .even
 002A           _ConfigureCC1000::
 002A 0E940000          xcall push_gset3
 002E                   .dbline -1
 002E                   .dbline 106
 002E           ;           for(j = 0;j < t;j++);
 002E           ;        }
 002E           ;       /////////////// ////////////////////////////////////////////stdio.h
 002E           ; /****************************************************************************//////////////////////原始的CONFIG
 002E           ; /*  This routine sends new configuration data to the CC1000                 */
 002E           ; /*  Based on bit bashing (general I/O pin use)                              */
 002E           ; /****************************************************************************/
 002E           ; 
 002E           ; void ConfigureCC1000(char Count, short Configuration[])
 002E           ; {
 002E                   .dbline 113
 002E           ;   char  BitCounter;
 002E           ;   char  WordCounter;
 002E           ;   short Data;
 002E           ;  
 002E           ;  
 002E           ;    
 002E           ;   PORTD|=(1<<PALE); //PALE=1
 002E 959A              sbi 0x12,5
 0030                   .dbline 115
 0030           ;   
 0030           ;   for (WordCounter=0;WordCounter<Count;WordCounter++)
 0030 4427              clr R20
 0032 2FC0              xjmp L14
 0034           L11:
 0034                   .dbline 116
 0034           ;   {
 0034                   .dbline 117
 0034           ;     Data=Configuration[WordCounter];
 0034 82E0              ldi R24,2
 0036 849F              mul R24,R20
 0038 F001              movw R30,R0
 003A E20F              add R30,R18
 003C F31F              adc R31,R19
 003E 6081              ldd R22,z+0
 0040 7181              ldd R23,z+1
 0042                   .dbline 118
 0042           ;     PORTD&=~(1<<PALE); // PALE=0
 0042 9598              cbi 0x12,5
 0044                   .dbline 121
 0044           ;     
 0044           ;     /* Send address bits */
 0044           ;   for (BitCounter=0;BitCounter<7;BitCounter++)
 0044 AA24              clr R10
 0046 0AC0              xjmp L18
 0048           L15:
 0048                   .dbline 122
 0048           ;     {
 0048                   .dbline 123
 0048           ;       PORTD|=(1<<PCLK); // PCLK=1
 0048 949A              sbi 0x12,4
 004A                   .dbline 124
 004A           ;       if ((Data&0x8000)==0) {
 004A 77FD              sbrc R23,7
 004C 02C0              rjmp L19
 004E                   .dbline 124
 004E                   .dbline 125
 004E           ;         PORTD&=~(1<<PDATA); // PDATA=0
 004E 9398              cbi 0x12,3
 0050                   .dbline 126
 0050           ;       }
 0050 01C0              xjmp L20
 0052           L19:
 0052                   .dbline 127
 0052           ;       else {
 0052                   .dbline 128
 0052           ;         PORTD|=(1<<PDATA); // PDATA=1
 0052 939A              sbi 0x12,3
 0054                   .dbline 129
 0054           ;       }
 0054           L20:
 0054                   .dbline 130
 0054 660F              lsl R22
 0056 771F              rol R23
 0058                   .dbline 131
 0058 9498              cbi 0x12,4
 005A                   .dbline 132
 005A           L16:
 005A                   .dbline 121
 005A A394              inc R10
 005C           L18:
 005C                   .dbline 121
 005C 8A2D              mov R24,R10
 005E 8730              cpi R24,7
 0060 98F3              brlo L15
 0062                   .dbline 137
 0062           ;       Data=Data<<1;
 0062           ;       PORTD&=~(1<<PCLK); //PCLK=0;
 0062           ;     }
 0062           ;     
 0062           ;     /* Send read/write bit */
 0062           ;     /* Ignore bit in data, always use 1 */
 0062           ;     
 0062           ;     PORTD|=(1<<PCLK); //PCLK=1
 0062 949A              sbi 0x12,4
 0064                   .dbline 138
 0064           ;     PORTD|=(1<<PDATA);  //PDATA=1
 0064 939A              sbi 0x12,3
 0066                   .dbline 139
 0066           ;     PORTD&=~(1<<PCLK); //PCLK=0
 0066 9498              cbi 0x12,4
 0068                   .dbline 140
 0068           ;     Data=Data<<1;
 0068 660F              lsl R22
 006A 771F              rol R23
 006C                   .dbline 141
 006C           ;     PORTD|=(1<<PCLK); //PCLK=1
 006C 949A              sbi 0x12,4
 006E                   .dbline 142
 006E           ;     PORTD|=(1<<PALE); //PALE=1
 006E 959A              sbi 0x12,5
 0070                   .dbline 146
 0070           ;     
 0070           ;     /* Send data bits */
 0070           ;     
 0070           ;     for (BitCounter=0;BitCounter<8;BitCounter++)
 0070 AA24              clr R10
 0072 0AC0              xjmp L24
 0074           L21:
 0074                   .dbline 147
 0074           ;     {
 0074                   .dbline 148
 0074           ;       PORTD|=(1<<PCLK); //PCLK=1
 0074 949A              sbi 0x12,4
 0076                   .dbline 149
 0076           ;       if ((Data&0x8000)==0) {
 0076 77FD              sbrc R23,7
 0078 02C0              rjmp L25
 007A                   .dbline 149
 007A                   .dbline 150
 007A           ;         PORTD&=~(1<<PDATA); // PDATA=0
 007A 9398              cbi 0x12,3
 007C                   .dbline 151
 007C           ;       }
 007C 01C0              xjmp L26
 007E           L25:
 007E                   .dbline 152
 007E           ;       else {
 007E                   .dbline 153
 007E           ;         PORTD|=(1<<PDATA); // PDATA=1
 007E 939A              sbi 0x12,3
 0080                   .dbline 154
 0080           ;       }
 0080           L26:
 0080                   .dbline 155
 0080 660F              lsl R22
 0082 771F              rol R23

⌨️ 快捷键说明

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