main.h

来自「由P89V51RB2单片机控制小车在翘翘板上寻找平衡点,装载倾角传感器.」· C头文件 代码 · 共 72 行

H
72
字号
/*------------------------------------------------------------------

   Main.H (v1.00)

------------------------------------------------------------------*/

#ifndef _MAIN_H
#define _MAIN_H

//------------------------------------------------------------------
// WILL NEED TO EDIT THIS SECTION FOR EVERY PROJECT
//------------------------------------------------------------------

// Must include the appropriate microcontroller header file here
#include <reg52.h>

// Include oscillator / chip details here 
// (essential if generic delays / timeouts are used)
//  -
// Oscillator / resonator frequency (in Hz) e.g. (11059200UL)
#define OSC_FREQ (11059200UL)

// Number of oscillations per instruction (4, 6 or 12)
// 12 - Original 8051 / 8052 and numerous modern versions
//  6 - Various Infineon and Philips devices, etc.
//  4 - Dallas, etc.
//
// Take care with Dallas devices 
// - Timers default to *12* osc ticks unless CKCON is modified 
// - If using generic code on a Dallas device, use 12 here
#define OSC_PER_INST (12)

//------------------------------------------------------------------
// SHOULD NOT NEED TO EDIT THE SECTIONS BELOW
//------------------------------------------------------------------
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long uLong;


typedef bit BOOL;


#ifndef FALSE
#define FALSE (bit)0
#define TRUE  (bit)1
#endif
//------------------------------------------------------------------
// Interrupts

//------------------------------------------------------------------

#define T0_Overflow 1
#define T1_Overflow 3
#define T2_Overflow 5
#define EXTERNAL_0 0
#define EXTERNAL_1 2
#define UART_Rx_Tx 4
#define CAN_c515c 17


//I2C bus
sbit I2C_SCL = P1^0;
sbit I2C_SDA = P1^1;


#endif

/*------------------------------------------------------------------
  ---- END OF FILE -------------------------------------------------
------------------------------------------------------------------*/

⌨️ 快捷键说明

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