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

📄 main.lst

📁 keelop的877与913源代码架构为做遥控的朋友提供帮助
💻 LST
📖 第 1 页 / 共 4 页
字号:
CCS PCM C Compiler, Version 3.187, 16465

               Filename: main.LST

               ROM used: 33 (1%)
                         Largest free fragment is 2048
               RAM used: 32 (17%) at main() level
                         32 (17%) worst case
               Stack:    0 locations

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   004
0003:  NOP
....................    
.................... // *********************************************************************  
.................... //  Filename:   MAIN.c  
.................... // *********************************************************************  
.................... //  Author:     Lucio Di Jasio  
.................... //  Company:    Microchip Technology  
.................... //  Revision:   Rev 1.00  
.................... //  Date:       08/07/00  
.................... //  
.................... //  Keeloq Normal Learn Decoder on a mid range PIC   
.................... //  full source in C  
.................... //  
.................... //  Compiled using HITECH PIC C compiler v.7.93  
.................... //  Compiled using CCS    PIC C compiler v. 2.535  
.................... // ********************************************************************  
....................   
.................... #include "decccs.h"  // uncomment for CCS compiler 
....................  //   Module DECCCS.h  
.................... //   
.................... //  include this file when using the CCS C compiler  
.................... //  
.................... #define CCS  
....................   
.................... #DEVICE PIC16C63  
....................   
.................... typedef short bit;              // one bit  
.................... typedef unsigned int byte;      // one byte unsigned  
.................... typedef signed   int sbyte;     // one byte signed  
.................... typedef signed  long word;      // one word signed  
....................   
.................... // un-supported directives  
.................... //#define static  
.................... //#define volatile  
.................... #define interrupt  
....................   
.................... #define TRUE    1  
.................... #define FALSE   0  
.................... #define ON      1  
.................... #define OFF     0  
....................   
.................... //  
.................... // F872 special function registers  
.................... //  
.................... #byte TMR0 = 0x01       // Timer 0  
.................... #bit  T0IF = 0x0B.2     // Timer 0 interrupt flag  
.................... #bit  T0IE = 0x0B.5     // Timer 0 interrupt enable  
.................... #bit  GIE  = 0x0B.7     // Global Interrupt Enable  
....................   
.................... #byte OPTION = 0x81     // prescaler timer0 control  
.................... #byte ADCON1 = 0x9f     // A/D converter control  
....................   
.................... #byte TRISA = 0x85      // PORT A  
.................... #byte PORTA = 0x05  
.................... #bit RA0 = 0x05.0  
.................... #bit RA1 = 0x05.1  
.................... #bit RA2 = 0x05.2  
.................... #bit RA3 = 0x05.3  
.................... #bit RA4 = 0x05.4  
.................... #bit RA5 = 0x05.5  
....................   
.................... #byte TRISB = 0x86      // PORT B  
.................... #byte PORTB = 0x06  
.................... #bit RB0 = 0x06.0  
.................... #bit RB1 = 0x06.1  
.................... #bit RB2 = 0x06.2  
.................... #bit RB3 = 0x06.3  
.................... #bit RB4 = 0x06.4  
.................... #bit RB5 = 0x06.5  
.................... #bit RB6 = 0x06.6  
.................... #bit RB7 = 0x06.7  
....................   
.................... #byte TRISC = 0x87      // PORT C  
.................... #byte PORTC = 0x07  
....................   
.................... // internal EEPROM access  
.................... #byte EEADR  = 0x10d  
.................... #byte EEDATA = 0x10c  
.................... #byte EECON1 = 0x18c  
.................... #byte EECON2 = 0x18d  
.................... #bit  WR =   0x18c.1  
.................... #bit  RD =   0x18c.0  
.................... #bit  WREN = 0x18c.2  
.................... #bit  EEPGD =0x18c.7   
....................   
.................... // macro versions of EEPROM write and read   
.................... #define	EEPROM_WRITE(addr, value) while(WR)continue;EEADR=(addr);EEDATA=(value);EEPGD=0;GIE=0;WREN=1;\  
.................... 					EECON2=0x55;EECON2=0xAA;WR=1;WREN=0  
.................... #define	EEPROM_READ(addr) ((EEADR=(addr)),(EEPGD=0),(RD=1),EEDATA)  
....................   
.................... // configuration and ID locations  
.................... #FUSES RC, NOWDT, NOPROTECT, BROWNOUT  
.................... #ID 0x1234  
....................   
....................   
....................  
.................... //#include "dechit.h" // uncomment for HiTech compiler  
.................... //  
....................   
.................... //---------------------------------------------------------------------  
.................... // I/O definitions for PIC16F872  
.................... // compatible with PICDEM-2 demo board  
.................... //  
.................... //           +-------- -------+  
.................... //  Reset   -|MCLR    O    RB7|-  NU(ICD data)  
.................... //  (POT)   -|RA0          RB6|-  NU(ICD clock)  
.................... //  RFin    -|RA1          RB5|-  Vlow(Led)  
.................... //  NU      -|RA2          RB4|-  LearnOut(Led)  
.................... //  NU      -|RA3      PRG/RB3|-  Out3(Led)  
.................... //  Learn   -|RA4/T0CKI    RB2|-  Out2(Led)  
.................... //  NU      -|RA5          RB1|-  Out1(Led)  
.................... //  GND     -|Vss      INT/RB0|-  Out0(Led)  
.................... //  XTAL    -|OSCIN        Vdd|-  +5V   
.................... //  XTAL    -|OSCOUT       Vss|-  GND   
.................... //  NU      -|RC0       RX/RC7|-  NU(RS232)   
.................... //  NU      -|RC1       TX/RC6|-  NU(RS232)    
.................... //  NU(SW3) -|RC2/CCP1     RC5|-  NU     
.................... //  NU      -|RC3/SCL  SDA/RC4|-  NU     
.................... //           +----------------+  
.................... //  
....................   
....................   
....................   
.................... #define RFIn   RA1           // i radio signal input  
.................... #define Learn  RA4           // i learn button   
....................   
.................... #define Out0   RB0           // o S0 output  
.................... #define Out1   RB1           // o S1 output  
.................... #define Out2   RB2           // o S2 output  
.................... #define Out3   RB3           // o S3 output  
.................... #define  Led   RB4           // o LearnOut Led  
.................... #define Vlow   RB5           // o low battery   
....................   
.................... #define MASKPA  0xff         // port A I/O config (all input)  
.................... #define MASKPB  0xc0         // port B I/O config (6 outputs)  
.................... #define MASKPC  0xff         // port C I/O config (NU)  
....................   
.................... // -----------------global variables ---------------------------  
....................   
....................  byte Buffer[9];             // receive buffer  
....................   
.................... //---------------------------------------------------------------  
.................... //  
.................... // keeloq receive buffer map  
.................... //  
.................... // | Plain text                                | Encrypted  
.................... // RV000000.KKKKIIII.IIIIIIII.IIIIIIII.IIIIIIII.KKKKOODD.DDDDDDDD.SSSSSSSS.SSSSSSSS  
.................... //      8       7       6        5         4       3         2        1        0  
.................... //  
.................... // I=S/N   -> SERIAL NUMBER       (28 BIT)  
.................... // K=KEY   -> buttons encoding     (4 BIT)  
.................... // S=Sync  -> Sync counter        (16 BIT)  
.................... // D=Disc  -> Discrimination bits (10 BIT)  
.................... // R=Rept  -> Repeat/first         (1 BIT)  
.................... // V=Vlow  -> Low battery          (1 BIT)  
.................... //  
.................... //-- alias -------------------------------------------------------------  
.................... //  
....................   
....................   
.................... #define     HopLo   Buffer[0] //sync counter  
.................... #define     HopHi   Buffer[1] //  
.................... #define     DisLo   Buffer[2] //discrimination bits LSB  
.................... #define     DOK     Buffer[3] //Disc. MSB + Ovf + Key  
.................... #define     IDLo    Buffer[4] //S/N LSB  
.................... #define     IDMi    Buffer[5] //S/N   
.................... #define     IDHi    Buffer[6] //S/N MSB  
....................   
.................... #define S0  5   //  Buffer[3] function codes  
.................... #define S1  6   //  Buffer[3] function codes  
.................... #define S2  7   //  Buffer[3] function codes  
.................... #define S3  4   //  Buffer[3] function codes  
.................... #define VFlag  7//  Buffer[8] low battery flag  
....................   
.................... //----------------- flags defines ------------------------------------  
.................... bit FHopOK;     // Hopping code verified OK  
.................... bit FSame;      // Same code as previous  
.................... bit FLearn;     // Learn mode active  
.................... bit F2Chance;   // Resync required  
....................   
.................... //--------------------------------------------------------------------  
.................... // timings  
.................... //  
....................   
....................   
.................... #define TOUT    5           //   5 * 71ms = 350ms output delay  
.................... #define TFLASH  2           //   4 * 71ms = 280ms half period  
.................... #define TLEARN  255         // 255 * 71ms =  18s  learn timeout  
....................   
....................   
.................... byte Flags;                 // various flags  
.................... byte CLearn, CTLearn;       // learn timers and counter  
.................... byte CFlash, CTFlash;       // led flashing timer and counter  
.................... byte COut;                  // output timer  
.................... byte FCode;      // function codes and upper nibble of serial number  
....................   
.................... word Dato;       // temp storage for read and write to mem.  
.................... word Ind;        // address pointer to record in mem.  
.................... word Hop;        // hopping code sync counter  
.................... word EHop;       // last value of sync counter (from EEPROM)  
.................... word ETemp;      // second copy of sync counter  
....................   
....................   
.................... //  
.................... // interrupt receiver  
.................... //  
....................   
.................... #include "rxi.c" 
....................  /*  
.................... #include <pic1687x.h> // uncomment for HiTech compiler  
....................   
.................... // **********************************************************************  
.................... //  Filename:   receiver.c  
.................... // *********************************************************************  
.................... //  Author:     skywang  
.................... //  Company:    cjae Technology  
.................... //  Revision:   Rev 1.00  
.................... //  Date:       08/07/07  
.................... //  
.................... //  Interrupt based receive routine  
.................... //  
.................... //  Compiled using HiTech PIC C compiler v.7.93  
.................... //  Compiled using CCS    PIC C compiler v.2.535  
.................... // ********************************************************************  
.................... #define CLOCK           4       // MHz  
.................... #define TE            400       // us  
.................... #define OVERSAMPLING    3         
.................... #define PERIOD          TE/OVERSAMPLING*4/CLOCK   //133.3us  
....................   
.................... #define NBIT            65      // number of bit to receive -1  
....................   
.................... //byte B[9];                      // receive buffer   
....................   
.................... //static byte  RFstate;           // receiver state  
.................... //static sbyte RFcount;           // timer counter  
.................... //static byte  Bptr;              // receive buffer pointer  
.................... //static byte  BitCount;          // received bits counter  
.................... word   XTMR;                    // 16 bit extended timer  
....................   
.................... volatile bit RFFull;            // buffer full  
.................... volatile bit RFBit;             // sampled RF signal  
....................   
.................... #define TRFreset    0  
.................... #define TRFSYNC     1  
.................... #define TRFUNO      2  
.................... #define TRFZERO     3  
....................   
.................... #define HIGH_TO     -10         // longest high Te  
.................... #define LOW_TO       10         // longest low  Te  
.................... #define SHORT_HEAD   20         // shortest Thead accepted 2,7ms  
.................... #define LONG_HEAD    45         // longest Thead accepted 6,2ms  
....................   

⌨️ 快捷键说明

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