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

📄 defines.h

📁 AVR系列被广泛应用的单片机MEGA8开发(原理图)及例程
💻 H
字号:
/* Select Device (Select one, comment out the others) */
//#define _ATMEGA32
// #define _ATMEGA161 
//#define _ATMEGA163 
 #define _ATMEGA8
/* Select Boot Size (select one, comment out the others).
   NB!!! Remember to manually change the linker command file accordingly !!!
   i.e Set "Code = xxxx-xxxx" accordingly. See issue 1) under the Special 
   considerations section in the Appnote.*/
//#define _B128 
//#define _B256 
#define _B512 
//#define _B1024 
//#define _B2048

// Define pin for enter selfprogramming mode
#define PROGPORT PORTD
#define PROGPIN PIND
#define PROGCTRL (1<<PD2)
#define PROGMODE !(PROGPIN & PROGCTRL)  
// TRUE if PROGCTRL on PROGPIN is low

#ifdef _ATMEGA32 
  #include "iom32v.h"
  #define PARTCODE 0x73
  
  #define sig_byte1 0x1E
  #define sig_byte2 0x95
  #define sig_byte3 0x01
  #define PAGESIZE 128      //Size in Bytes
  
  #ifdef _B128
    #error This part does not support 128 word boot block
  #endif
  #ifdef _B256
    #define APP_PAGES ((2*16384 / PAGESIZE)- (2*256 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif
  #ifdef _B512
    #define APP_PAGES ((2*16384 / PAGESIZE)- (2*512 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif
   #ifdef _B1024
    #define APP_PAGES ((2*16384 / PAGESIZE)- (2*1024 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif
  #ifdef _B2048
    #define APP_PAGES ((2*16384 / PAGESIZE)- (2*2048 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif
#endif

#ifdef _ATMEGA161
  #include "iom161v.h"
 #define PARTCODE 0x61

 #define sig_byte1 0x1E
 #define sig_byte2 0x94
 #define sig_byte3 0x01
  #define PAGESIZE 128       //Size in Bytes
  #ifdef _B128
    #error The ATmega161 only supports 512 words boot block
  #endif
  #ifdef _B256 
    #error The ATmega161 only supports 512 words boot block
  #endif
  #ifdef _B512 
    #define APP_PAGES ((2*8192 / PAGESIZE )- (2*512 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif
  #ifdef _B1024 
    #error The ATmega161 only supports 512 words boot block
  #endif
  #ifdef _B2048 
    #error The ATmega161 only supports 512 words boot block
  #endif
#endif

#ifdef _ATMEGA163
  #include "iom163v.h"
  #define PARTCODE 0x66

  #define sig_byte1 0x1E
  #define sig_byte2 0x94
  #define sig_byte3 0x02
  #define PAGESIZE 128      //Size in Bytes
  
  #ifdef _B128
    #error This program does not fit in 128 words, minimum 256 words
  #endif
  #ifdef _B256
    #define APP_PAGES ((2*8192 / PAGESIZE)- (2*256 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif
  #ifdef _B512
    #define APP_PAGES ((2*8192 / PAGESIZE)- (2*512 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif
   #ifdef _B1024
    #define APP_PAGES ((2*8192 / PAGESIZE)- (2*1024 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif  
  #ifdef _B2048
    #error This part does not support 2048 word boot block
  #endif
#endif


#ifdef _ATMEGA8
  #include "iom8v.h"
  #define PARTCODE 0x66
  #define sig_byte1 0x1E
  #define sig_byte2 0x94
  #define sig_byte3 0x07
  #define PAGESIZE 64      //Size in Bytes
  
  #ifdef _B128
    #define APP_PAGES ((2*4096 / PAGESIZE)- (2*128 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif
  #ifdef _B256
    #define APP_PAGES ((2*4096 / PAGESIZE)- (2*256 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif
  #ifdef _B512
    #define APP_PAGES ((2*4096 / PAGESIZE)- (2*512 / PAGESIZE )) 
    #define APP_END  APP_PAGES * PAGESIZE 
  #endif
   #ifdef _B1024
    #define APP_PAGES ((2*4096 / PAGESIZE)- (2*1024 / PAGESIZE )) 
    #define APP_END APP_PAGES * PAGESIZE 
  #endif  
  #ifdef _B2048
    #error This part does not support 2048 word boot block
  #endif
#endif


⌨️ 快捷键说明

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