📄 per.h
字号:
// ADFullValue---full value that A/D converter can store;
// Vref---reference voltage of A/D converter.
//return: input voltage.
//******************************************************************************************
//float AD_V(unsigned int ADValue,unsigned int ADFullValue,float Vref);
//******************************************************************************************
//function: float sensor_value(unsigned int Rs1,unsigned int ad);
//description: calculate the sensor's resistance by given parameter.
//parameter: Rs1---resistance of the sensor bridge;
// ad---the A/D result
//return: the sensor's resistance.
//******************************************************************************************
float sensor_value(float Rs1,float ad);
/*
///////////////////prototype for PWM/////////////////////////////////////////////
//*******************************************************************************
//function: bit timer2_init(float fre);
//input: float fre (KHz)timer2 overflow frequency
//return: 1 error;
// 0 right;
//*******************************************************************************
//bit timer2_init(float); //timer2 initialization (used for interrupt function);
//*******************************************************************************
//function: bit timer2_init_auto(float fre);
//input: float fre (KHz)timer2 overflow frequency
//return: 1 error;
// 0 right;
//*******************************************************************************
bit timer2_init_auto(float);//timer2 initialization (used for autoreload function;
//*******************************************************************************
//function: void timer2_load(unsigned char num,float rate);
//input: unsigned char num select cc;(if timer2 is used for autoreload mode,
// cc0 may not be used)
// float rate PWM pulse duty sycle 0~100;
//return: none;
//*******************************************************************************
void timer2_load(unsigned char,float); //timer2 load value for pulse generation;
*/
///////////////////////operations about X5045///////////////////////////////
//*****************************************************************************************
//function: unsigned char read_8bit(void);
//description: this function read 8 bit from x5045
//parameter: none
//return: the read byte
//*****************************************************************************************
unsigned char read_8bit(void);
//*****************************************************************************************
//function: void write_8bit(unsigned char WriteValue);
//description: this function write 8 bit to x5045
//parameter: the value need to be write
//return: none
//*****************************************************************************************
void write_8bit(unsigned char WriteValue);
void write_8bit1(unsigned char WriteValue);
//*****************************************************************************************
//function: void init_5045wdt(unsigned char WatchDogTime);
//description: this function initialize the x5045 watch dog timer
//parameter: watch dog time
//return: none
//*****************************************************************************************
void init_5045wdt(unsigned char WatchDogTime);
//*****************************************************************************************
//function: void write_byte(unsigned char address,unsigned char content);
//description: this function write one byte to x5045
//parameter: address---address of memory need to be write ;content---content need to be write
//return: none
//*****************************************************************************************
void write_byte(unsigned char address,unsigned char content);
//*****************************************************************************************
//function: unsigned char read_byte(unsigned char address);
//description: this function read one byte from x5045
//parameter: address---address of memory need to be read
//return: the read content.
//*****************************************************************************************
unsigned char read_byte(unsigned char address);
//*****************************************************************************************
//function: void write_page_float4(unsigned char StartAddr,float value);
//description: this function write float data to x5045,the first byte address is specified
//parameter: StartAddr---the first address of the unit will be write;value---value to be write
//return: none
//*****************************************************************************************
void write_page_float4(unsigned char StartAddr,float value);//write 4 byte float data to x5045
//*****************************************************************************************
//function: void write_page_array12(unsigned char StartAddr,unsigned char *p)
//description: this function write 12 byte data to x5045,the first byte address is specified
//parameter: StartAddr---the first address of the unit will be write;value---value to be write
// p---pointer to array
//return: none
//*****************************************************************************************
void write_page_array12(unsigned char StartAddr,unsigned char *p);//write 12 byte data to x5045
//*****************************************************************************************
//function: void write_page_array4(unsigned char StartAddr,unsigned char *p)
//description: this function write 4 byte data to x5045,the first byte address is specified
//parameter: StartAddr---the first address of the unit will be write;value---value to be write
// p---pointer to array
//return: none
//*****************************************************************************************
//void write_page_array4(unsigned char StartAddr,unsigned char *p);//write 4 byte data to x5045
void write1_page_array4(unsigned char StartAddr,unsigned char *p);//write 12 byte data to x5045
//*****************************************************************************************
//function: float read_page_float4(unsigned char FirstAddr);
//description: this function read float data from x5045,the first byte address is specified
//parameter: addr---the first address of the unit will be read;
//return: the storing float data
//*****************************************************************************************
float read_page_float4(unsigned char FirstAddr);
float read1_page_float4(unsigned char FirstAddr);
////////////////////prototype for watchdog///////////////////////////////////////
//*******************************************************************************
//function: void wdt_start(void);
//description: initialize watch dog timer
//parameter: none
//return: none
//********************************************************************************
void wdt_init(void);//watchdog timer start
//********************************************************************************
//function: void wdt_refresh(void);
//input: none;
//return: none;
//********************************************************************************
void wdt_refresh(void); //watchdog timer refresh;
//////////// functions for finding bit from message table/////////////////////////
//******************************************************************************
//function: bit get_bit(unsigned char ModuleName,unsigned char BitNumber,
// unsigned char * BasePointer);
//description: thi function get the bit value from specified location of
// the seven row and eight line array such as MsgTrans[7][8].
//parameter: ModuleName---which module;BitNumber---bit location of the data block
// BasePointer---the pointer pointing to the base address.
//return: the bit value.
//******************************************************************************
bit get_bit(unsigned char ModuleName,unsigned char BitNumber,unsigned char * BasePointer);
//******************************************************************************
//function: void set_bit(unsigned char ModuleName,unsigned char BitNumber,bit value
// unsigned char * BasePointer);
//description: thi function set the bit value specified location of
// the seven row and eight line array such as MsgTrans[7][8].
//parameter: ModuleName---which module;BitNumber---bit location of the data block
// value---specified bit value;
// BasePointer---the pointer pointing to the base address.
//return: none. |
//******************************************************************************
void set_bit(unsigned char ModuleName,unsigned char BitNumber,bit value,unsigned char * BasePointer);
//******************************************************************************
//function: bit get_bit1(unsigned char ModuleName,unsigned char BitNumber,
// unsigned char * BasePointer);
//description: thi function get the bit value from specified location of
// the seven row and eight line array such as MsgTrans[7][8].
//parameter: ModuleName---which module;BitNumber---bit location of the data block
// BasePointer---the pointer pointing to the base address.
//return: the bit value. |
//******************************************************************************
bit get_bit1(unsigned char ModuleName,unsigned char BitNumber,unsigned char * BasePointer);
//******************************************************************************
//function: void set_bit1(unsigned char ModuleName,unsigned char BitNumber,bit value
// unsigned char * BasePointer);
//description: thi function set the bit value specified location of
// the seven row and eight line array such as MsgTrans[7][8].
//parameter: ModuleName---which module;BitNumber---bit location of the data block
// value---specified bit value;
// BasePointer---the pointer pointing to the base address.
//return: none. |
//******************************************************************************
void set_bit1(unsigned char ModuleName,unsigned char BitNumber,bit value,unsigned char * BasePointer);
//******************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -