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

📄 sp35_devlib.lst

📁 英飞凌公司的单片机的测试计量程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
 130   2                              P1Out &= ~(GPR0>>4);            // Set Tx Bit = 0
 131   2                      Result >>= 1;                                   // Shift Result one bit left to prepare next bit
 132   2                      IDLE = 1;                                               // Wait for a timer event before starting transmission
 133   2                      T0Full = 0;                                             // Write to Timer full event flag to reset it
 134   2              }
 135   1      
 136   1              // STOP Bit
 137   1              P1Out |= (GPR0>>4);                                     // Set Tx Bit = 1
 138   1              IDLE = 1;                                                       // Wait for a timer event before starting transmission
 139   1              T0Full = 0;                                                     // Write to Timer full event flag to reset it
 140   1              T0Run = 0;                                                      // Stop Timer0
 141   1      
 142   1              // RESTORE old Timer SFR values
 143   1              TMOD = TMOD_old;
 144   1              TH0 = TH0_old;
 145   1              TL0 = TL0_old;
 146   1              
 147   1              return Result;
 148   1      }
 149          
 150          /**********************************************************************************
 151           Reads one character from UART
 152          ***********************************************************************************/
 153          char getchar (void)
 154          {
 155   1              unsigned char i; 
 156   1              unsigned char Character = 0;
 157   1              unsigned char TMOD_old, TL0_old, TH0_old;
 158   1              
 159   1              // SAVE olf Timer Registers 
 160   1              TMOD_old = TMOD;
 161   1              TL0_old = TL0;
 162   1              TH0_old = TH0;
 163   1      
 164   1              TMOD = 0x12;                                    // Set up Timer Mode 2 and systemclock/8 as timebase
 165   1          
 166   1              if (DSR & 0x80)                                 // IF CRYSTAL IS USED DETERMINE CRYSTAL FREQ AND SET TIMER
 167   1              {
 168   2                      #ifdef _19687500_Crystal_315MHz         
 169   2                              TL0 = 0x60;
 170   2                              TH0 = 0x40;
 171   2                      #endif
 172   2      
 173   2                      #ifdef _18080000_Crystal_433_92MHz
                                      TL0 = 0x59;
                                      TH0 = 0x3B;
                              #endif
 177   2              }
 178   1              
C51 COMPILER V8.05a   SP35_DEVLIB                                                          06/01/2007 15:22:01 PAGE 4   

 179   1              else                                                    // IF RC-HF IS USED USE DEFAULT VALUES   
 180   1              {
 181   2                              TL0 = 0x75;
 182   2                              TH0 = 0x4E;
 183   2              }
 184   1      
 185   1              while (P1In & (GPR0 & 0x0F))            // Wait for a high to low transition on PP1 (RX)
 186   1              {
 187   2                      CFG2 |= 0x02;                                   // Reset Watchdog timer while waiting
 188   2              }
 189   1      
 190   1              T0Run = 1;                                                      // Start timer 0 with 1,5* Bitperiod
 191   1              IDLE = 1;                                                       // Wait for a timer event before starting reseption
 192   1              T0Full = 0;                                                     // Write to Timer full event flag to reset it
 193   1      
 194   1              for (i = 0; i < 8; i++)
 195   1              {
 196   2                      Character >>= 1;                                // Shift Receiver byte one bit right
 197   2                      if (P1In & (GPR0 & 0x0F))
 198   2                              Character |= 0x80;                      // Set lowest bit if high level on RX line
 199   2                      IDLE = 1;                                               // Wait for a timer event before starting reseption
 200   2                      T0Full = 0;                                             // Write to Timer full event flag to reset it
 201   2              }
 202   1      
 203   1              // RESTORE old Timer SFR values
 204   1              TMOD = TMOD_old;
 205   1              TH0 = TH0_old;
 206   1              TL0 = TL0_old;
 207   1      
 208   1              return Character;
 209   1      }
 210          
 211          /**********************************************************************************
 212           This function loads the Trimming Value from the FLASH to the appropriate
 213           Register. This is only needed if the FLASH is not locked by IFX.
 214          **********************************************************************************/
 215          void RC_Trimming()
 216          {
 217   1              unsigned char code *pu8;
 218   1              unsigned char idata trimming;   
 219   1              pu8=0x58A8;
 220   1              trimming = *pu8;
 221   1              OSCCONF = trimming;             // Write correct trimming value from Flash
 222   1      }
 223          
 224          /**********************************************************************************
 225           This function configures the RF Transmitter SFR RFTX
 226           according to the defines in SP35_Defs.h. It returns the configured data
 227          **********************************************************************************/
 228          char RF_Config(void)
 229          {
 230   1              char temp=0x00;
 231   1              
 232   1              #ifdef _18080000_Crystal_433_92MHz
                              temp |= 0x04;
                      #endif
 235   1              #ifdef _3PA_Stages
 236   1                      temp |= 0x03;
 237   1              #endif
 238   1              #ifdef _2PA_Stages
                              temp |= 0x01;
                      #endif
C51 COMPILER V8.05a   SP35_DEVLIB                                                          06/01/2007 15:22:01 PAGE 5   

 241   1              #ifdef _INV
                              temp |= 0x40;
                      #endif
 244   1              #ifdef _50_DC
                              temp |= 0x10;
                      #endif
 247   1              #ifdef _ASK
                              temp |= 0x20;
                      #endif
 250   1              RFTX = temp;
 251   1              return temp;
 252   1      }       
 253          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    341    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       4
   IDATA SIZE       =   ----       1
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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