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

📄 eeprom.lst

📁 矿工定位系统单端
💻 LST
📖 第 1 页 / 共 2 页
字号:
 141          RETURNS: Nothing
 142          CAUTION: eeprom_init must be called first
 143          ************************************************************************/
 144          void eeprom_fillrow
 145            (
 146             unsigned int address,    // 9-bit starting address of row
 147                                      // (64-byte aligned)
 148             unsigned char value      // value to fill row with
 149            )
 150          {
 151   1        bit eacopy;
 152   1      
 153   1        // wait for previous operation to complete
 154   1        while (meeprombusy);
 155   1      
 156   1        // eeprom now busy
 157   1        meeprombusy = 1;
 158   1      
 159   1        // store bit 8 of address
 160   1        // row fill operation, clear interrupt flag
 161   1        DEECON = ((address >> 8) & 0x01) | 0x20;
*** ERROR C202 IN LINE 161 OF EEPROM.C: 'DEECON': undefined identifier
 162   1        // disable interrupts
 163   1        eacopy = EA;
 164   1        EA = 0;
 165   1        // store fill pattern
 166   1        DEEDAT = value;
*** ERROR C202 IN LINE 166 OF EEPROM.C: 'DEEDAT': undefined identifier
C51 COMPILER V7.05   EEPROM                                                                03/14/2004 11:08:57 PAGE 4   

 167   1        // store bits 0-7 of address (note bits 0-5 are ignored by device)
 168   1        DEEADR = address & 0xFF;
*** ERROR C202 IN LINE 168 OF EEPROM.C: 'DEEADR': undefined identifier
 169   1        // restore interrupts
 170   1        EA = eacopy;
 171   1      
 172   1        // if not using interrupt then poll for end of operation
 173   1        if (!EA || !EIEE)
*** ERROR C202 IN LINE 173 OF EEPROM.C: 'EIEE': undefined identifier
 174   1        {
 175   2          // wait for operation to complete
 176   2          while (!(DEECON & 0x80));
*** ERROR C202 IN LINE 176 OF EEPROM.C: 'DEECON': undefined identifier
 177   2          // eeprom no longer busy
 178   2          meeprombusy = 0;
 179   2        }
 180   1      }
 181          
 182          /***********************************************************************
 183          DESC:    Writes a value to every location in the EEPROM.
 184                   If either global interrupts or the EEPROM interrupt is disabled
 185                   then the function will return when the operation is complete.
 186                   If global interrupts and the EEPROM interrupt are enabled, the
 187                   function will return immediately and an interrupt will occur
 188                   when the operation is complete.
 189          RETURNS: Nothing
 190          CAUTION: eeprom_init must be called first
 191          ************************************************************************/
 192          void eeprom_fill
 193            (
 194            unsigned char value      // value to fill EEPROM with
 195            )
 196          {
 197   1        bit eacopy;
 198   1      
 199   1        // wait for previous operation to complete
 200   1        while (meeprombusy);
 201   1      
 202   1        // eeprom now busy
 203   1        meeprombusy = 1;
 204   1      
 205   1        // bit 8 of address = 1
 206   1        // block fill operation, clear interrupt flag
 207   1        DEECON = 0x31;
*** ERROR C202 IN LINE 207 OF EEPROM.C: 'DEECON': undefined identifier
 208   1        // disable interrupts
 209   1        eacopy = EA;
 210   1        EA = 0;
 211   1        // store fill pattern
 212   1        DEEDAT = value;
*** ERROR C202 IN LINE 212 OF EEPROM.C: 'DEEDAT': undefined identifier
 213   1        // store anything to address register - value ignored by device
 214   1        DEEADR = 0x00;
*** ERROR C202 IN LINE 214 OF EEPROM.C: 'DEEADR': undefined identifier
 215   1        // restore interrupts
 216   1        EA = eacopy;
 217   1      
 218   1        // if not using interrupt then poll for end of operation
 219   1        if (!EA || !EIEE)
*** ERROR C202 IN LINE 219 OF EEPROM.C: 'EIEE': undefined identifier
 220   1        {
 221   2          // wait for operation to complete
C51 COMPILER V7.05   EEPROM                                                                03/14/2004 11:08:57 PAGE 5   

 222   2          while (!(DEECON & 0x80));
*** ERROR C202 IN LINE 222 OF EEPROM.C: 'DEECON': undefined identifier
 223   2          // eeprom no longer busy
 224   2          meeprombusy = 0;
 225   2        }
 226   1      }
 227          
 228          /***********************************************************************
 229          DESC:    Erases a 64-byte row in the EEPROM.
 230                   If either global interrupts or the EEPROM interrupt is disabled
 231                   then the function will return when the operation is complete.
 232                   If global interrupts and the EEPROM interrupt are enabled, the
 233                   function will return immediately and an interrupt will occur
 234                   when the operation is complete.
 235                   Equivalent to eeprom_fillrow(address, 0x00);
 236          RETURNS: Nothing
 237          CAUTION: eeprom_init must be called first
 238          ************************************************************************/
 239          void eeprom_eraserow
 240            (
 241            unsigned int address      // 9-bit starting address of row
 242                                      // (64-byte aligned)
 243            )
 244          {
 245   1        eeprom_fillrow(address, 0x00);
 246   1      }
 247          
 248          /***********************************************************************
 249          DESC:    Erases the EEPROM.
 250                   If either global interrupts or the EEPROM interrupt is disabled
 251                   then the function will return when the operation is complete.
 252                   If global interrupts and the EEPROM interrupt are enabled, the
 253                   function will return immediately and an interrupt will occur
 254                   when the operation is complete.
 255                   Equivalent to eeprom_fill(0x00);
 256          RETURNS: Nothing
 257          CAUTION: eeprom_init must be called first
 258          ************************************************************************/
 259          void eeprom_erase
 260            (
 261            void
 262            )
 263          {
 264   1        eeprom_fill(0x00);
 265   1      }
 266          
 267          /***********************************************************************
 268          DESC:    EEPROM Interrupt Service Routine
 269                   Called when an EEPROM operation has completed
 270                   Uses register bank 1
 271          RETURNS: Nothing
 272          CAUTION: eeprom_init must be called first
 273          ************************************************************************/
 274          void eeprom_isr
 275            (
 276            void
 277            ) interrupt 14 using 1
 278          {
 279   1        // clear EEIF flag
 280   1        DEECON &= ~0x80;
*** ERROR C202 IN LINE 280 OF EEPROM.C: 'DEECON': undefined identifier
 281   1        // eeprom no longer busy
C51 COMPILER V7.05   EEPROM                                                                03/14/2004 11:08:57 PAGE 6   

 282   1        meeprombusy = 0;
 283   1      }
 284          

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

⌨️ 快捷键说明

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