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

📄 common.h

📁 how to use display powertip PG 320x240
💻 H
字号:


#ifndef _COMMON_
#define _COMMON_

    #include "types.h"
    #include "appcfg.h"


    //constants for different processors
    #define CPU_ST10F168   1
    #define CPU_ST10F269   10
    #define CPU_ST10F280   11
    #define CPU_ST10F276   20
    #define CPU_ST10F272   21
    
    //posibble constant names for compiler type definition
    //(the names have to be defined in compiler not here in source code)
    //The names are:
    // _KEIL_       for Keil compiler
    // _TASKING7_   for Tasking v.7.5 compiler
    // _TASKING8_   for Tasking v.8.0 compilers

    //include header file with processor specific registers
    #if ( PROCESSOR == CPU_ST10F269 )
        #ifdef _KEIL_
            #include <regst10F269.h>
            //Define RTC registers
            #define RTCCON  (*((unsigned int volatile sdata *) 0xEC00))
            #define RTCPH   (*((unsigned int volatile sdata *) 0xEC08))
            #define RTCPL   (*((unsigned int volatile sdata *) 0xEC06))
            #define RTCAL   (*((unsigned int volatile sdata *) 0xEC12))
            #define RTCAH   (*((unsigned int volatile sdata *) 0xEC14))
            #define RTCL    (*((unsigned int volatile sdata *) 0xEC0E))
            #define RTCH    (*((unsigned int volatile sdata *) 0xEC10)) 
        #else
            #include <reg269.h>
        #endif
    #endif
    #if ( PROCESSOR == CPU_ST10F276 ) 
        #ifdef _KEIL_
            #include <st10F276.h>
        #else
            #include <reg276.h>
        #endif
    #endif
    #if ( PROCESSOR == CPU_ST10F272 ) 
        #ifdef _KEIL_
            #include <reg272.h>
        #else
            #include<reg272.h>
        #endif
    #endif

// ****************************************************************************
// ************************** Constants and Variables *************************
// ****************************************************************************

    //general error codes    
    #define OK              0
    #define FAIL            0xFFFF
    
    //register write error 
    //(register has wrong value. The value is different from the wrote one)
    //Derived values should be defined as #define FAIL_REGWRITE_A FAIL_REGWRITE+1
    #define FAIL_REGWRITE   0xF000
    
    //boolean constants
    #define TRUE     1
    #define FALSE    0
 
    //we want to use the same names for both compilers (KEIL, TASKING)
    #ifdef _KEIL_
        #include <intrins.h>        //to be able to use nop
        #define  _nop _nop_
        #define  _inline __inline
    #endif


#endif

// ***************************** End of common.h *****************************

⌨️ 快捷键说明

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