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

📄 main.h

📁 Real Time Operating System for Hi-Tech C compiler.
💻 H
字号:
void Init(void);

#if   defined(SYSA) \
  ||  defined(SYSH)

#include <pic.h>

#if ((_HTC_VER_MAJOR_*1000 + \
      _HTC_VER_MINOR_*  10 + \
      _HTC_VER_PATCH_*   1) < 8000 )
__CONFIG(FOSC0 | UNPROTECT);
#else
__CONFIG(XT & UNPROTECT);
#endif

#define PORTBIT(adr, bit) ((unsigned)(&adr)*8+(bit))  

#if   defined(SYSA)
#define LED_PORT        PORTB
#define LED_TRIS        TRISB
static bit keySW @ PORTBIT(PORTA, 4);
#elif defined(SYSH)
#define LED_PORT        PORTC
#define LED_TRIS        TRISC
static bit keySW @ PORTBIT(PORTB, 0);
#endif

#define ADGO_BIT        ADGO
#define ADREG           ADRESH

#define ADCON0_INIT     0b01000101
#define ADCON1_INIT     0b00001110

  



#elif defined(SYSE)

#include <p18cxxx.h>

//__CONFIG(1, EC & UNPROTECT);

#define LED_PORT        PORTB
#define LED_TRIS        TRISB

#define ADGO_BIT        ADCON0bits.GO
#define ADREG           ADRESH

#define ADCON0_INIT     0b01000101
#define ADCON1_INIT     0b00001110

#define keySW           PORTAbits.RA4


#elif defined(SYSF)

#include <pic18.h>

__CONFIG(1, EC & UNPROTECT);

#define LED_PORT        PORTB
#define LED_TRIS        TRISB

#define ADGO_BIT        GODONE
#define ADREG           ADRESH

#define ADCON0_INIT     0b01000101
#define ADCON1_INIT     0b00001110

#define PORTBIT(adr, bit)    ((unsigned)(&adr)*8+(bit))    
static bit keySW @ PORTBIT(PORTA, 4);


#elif defined(SYSP)

#include <io18c452.h>

//__CONFIG(1, EC & UNPROTECT);

#define LED_PORT        PORTB
#define LED_TRIS        TRISB

#define ADGO_BIT        GO_DONE
#define ADREG           ADRESH

#define ADCON0_INIT     0x45 // 0b01000101
#define ADCON1_INIT     0x0E // 0b00001110

#define keySW           RA4


#else /* SYS* not defined */                        
#error Undefined Salvo test system (SYS*). Definition required.


#endif

⌨️ 快捷键说明

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