STC32G 单片机系列通用定时器的用法及编程

news2024/11/13 9:43:13

STC32G单片机与STC15系列单片机一样有T0~T4共5个通用定时器。其功能大致相同,与STC15系列单片机定时器不同的是STC32G单片机的定时器每个都多了一个8位预分频器,如下:

这样定时器可作为一个24位定时器使用,做计数器使用与分频器就没有多大意义。

说到SCT32G单片机与STC5单片机的区别,这里就简单介绍一下。STC32G单片机的寄存器分SFR与XFR。XFR的逻辑地址位于XDATA区域,访问前需要将P_SW2寄存器的最高位(EAXFR)置1。如果STC15系列单片机的SFR的逻辑地址能够被8整除,那么该寄存器可位操作。STC32G单片机SFR都可位操作,XFR不可进行位操作,只能整体赋值。SCT32G单片机的寄存器依然是8位的,但SCT32G单片机包含32位加减和16位乘除法指令。SCT32G单片机还硬件扩充了32位乘除法单元MDU32。SCT32G系列单片机内部还集成了增强型的双数据指针。这些都是STC15系列单片机不具备的,另外STC32G单片机还较STC5单片机多出了CAN总线、LIN总线、USB串行总线、RTC实时时钟、LCM(I8080/M6800)接口、DMA等,功能较STC15系列单片机强大很多。可以说SCT32G是一款32位单片机。注意要使用MDU32需将STC官方的库文件加入到项目中。如下:

STC32G使用Keil C251编程,其操作与Kei C51没有明显区别。

继续定时器话题,定时器核心器件是一个加法计数器,其本质是对脉冲计数。计数脉冲来自系统时钟,定时器工作在定时方式(因为系统时钟是一定的,因而计数器寄存器溢出的时间是可预期的)。定时器的计数脉冲来自外部引脚,则工作在计数器方式。定时器的工作模式可以通过对相应寄存器的C/T位置1或置0来进行设置,如:T0是对TMOD寄存器的B2(T0_CT)位进行设置,置0就工作在定时方式,置1就工作在计数器方式。T1是对TMOD寄存器的B6(T1_CT)位进行设置,置0就工作在定时方式,置1就工作在计数器方式。T2是对AUXR寄存器的B3(T2_CT)位进行设置,置0就工作在定时方式,置1就工作在计数器方式。T3是对T4T3M寄存器的B2(T3_CT)位进行设置,置0就工作在定时方式,置1就工作在计数器方式。T4是对T4T3M寄存器的B2(T3_CT)位进行设置,置0就工作在定时方式,置1就工作在计数器方式。

定时器工作在定时模式时,可选对系统时钟不分频计数,或对系统时钟12分频计数。两种不同的计数是通过对计数器相应寄存器的Tnx12位来设置的。置1,不分频;置0,12分频。如:T0设置AUXR寄存器的B7位(T0x12),T1设置AUXR寄存器的B6位(T1x12),T2设置AUXR寄存器的B2位(T2x12),T3设置T4T3M寄存器的B1位(T3x12),T4设置T4T3M寄存器的B5位(T4x12)。

定时器0有4种工作模式:模式0(16位自动重装),模式1(16位不可重装),模式2(8位自动重装),模式3(不可屏蔽中断的16位自动重装)。定时器1有3种工作模式,机定时器0的前3重模式。定时器2、定时器3、定时器4只有16位自动重装一种工作模式。

定时器可用来定时、计数、可编程系统时钟输出及波特率发生器。定时器0不可做波特率发生器。我们还可以利用定时中断实现PWM脉冲输出、外部中断扩展、任意引脚可编程脉冲输出等功能。

定时器编程与GPIO编程一样离不开对相关寄存器的操作,STC32G系列单片机定时器的相关寄存器如下:

做单片机编程时,我们可以用宏来实现寄存器操作这类简单的操作。下面用宏函数来实现定时器相关寄存器的操作与设置。为便于与普通函数的区别,宏函数全部使用大写,具体代码如下:

///T0 Macro Function//

#define T0_TIMER()     {T0_CT = 0;} //timer0 work as timer
#define T0_COUNTER()   {T0_CT = 1;} //timer0 work as counter
#define T0_TCLK12T()   {T0x12 = 0;} //set timer clk cycle time to 12 tmes system clk cycle time
#define T0_TCLK1T()    {T0x12 = 1;} //set timer clk cycle time to system clk cycle time
#define T0_INTENABLE() {ET0 = 1;}   //timer0 INT enable
#define T0_INTDISABLE() {ET0 = 0;}  //timer0 INT disable
#define T0_START()   {TR0 = 1;}     //timer0 start
#define T0_SOP()   {TR0 = 0;}       //timer0 stop
#define T0_WAITOVERFLOW(){while(!TF0); TR0 = 0; TF0 = 0; } //wait timer0 conter register overflow
#define T0_CLKOUTENABLE() {T0CLKO = 1;} //timer0 clk output enable
#define T0_CLKOUTDISABLE() {T0CLKO = 0;} //timer0 clk output disable

#define T0MODE_AL16() {T0_M0 = 0; T0_M1 = 0;}    //auto load 16bit
#define T0MODE_NAL16() {T0_M0 = 1; T0_M1 = 0;}   // no auto load 16bit
#define T0MODE_AL8() {T0_M0 = 0; T0_M1 = 1;}     //auto load 8bit
#define T0MODE_USAL16() {T0_M0 = 1; T0_M1 = 1;}  //can not sheield auto load 16bit

///T1 Macro Function//
#define T1_TIMER()     {T1_CT = 0;} //timer1 work as timer
#define T1_COUNTER()   {T1_CT = 1;} //timer1 work as counter
#define T1_TCLK12T()   {T1x12 = 0;} //set timer clk cycle time to 12 tmes system clk cycle time
#define T1_TCLK1T()    {T1x12 = 1;} //set timer clk cycle timer to system clk cycle time
#define T1_INTENABLE() {ET1 = 1;}   //timer1 INT enable
#define T1_INTDISABLE() {ET1 = 0;}  //timer1 INT disable
#define T1_START()   {TR1 = 1;}     //timer1 start
#define T1_SOP()   {TR1 = 0;}       //timer1 stop
#define T1_WAITOVERFLOW(){while(!TF1); TR1 = 0; TF1 = 0; } //wait timer1 conter register overflow
#define T1_CLKOUTENABLE() {T1CLKO = 1;}       //timer1 clk output enable
#define T1_CLKOUTDISABLE() {T1CLKO = 0;}      //timer1 clk output disable
#define T1MODE_AL16() {T1_M0 = 0; T1_M1 = 0;} //auto load 16bit
#define T1MODE_NAL16() {T1_M0 = 1; T1_M1 = 0;}// no auto load 16bit
#define T1MODE_AL8() {T1_M0 = 0; T1_M1 = 1;}  //auto load 8bit

///T2 Macro Function/
#define T2_TIMER()     {T2_CT = 0;} //timer2 work as timer
#define T2_COUNTER()   {T2_CT = 1;} //timer2 work as counter
#define T2_TCLK12T()   {T2x12 = 0;} //set timer clk cycle time to 12 tmes system clk cycle time
#define T2_TCLK1T()    {T2x12 = 1;} //set timer clk cycle time to system clk cycle time
#define T2_INTENABLE() {ET2 = 1;}   //timer2 INT enable
#define T2_INTDISABLE() {ET2 = 0;}  //timer2 INT disable
#define T2_START()   {T2R = 1;}     //timer2 start
#define T2_STOP()   {T2R = 0;}      //timer2 stop
#define T2_WAITOVERFLOW(){while(!T2IF); T2R = 0; T2IF = 0; } //wait timer2 conter register overflow
#define T2_CLKOUTENABLE() {T2CLKO = 1;}  //timer2 clk output enable
#define T2_CLKOUTDISABLE() {T2CLKO = 0;} //timer2 clk output disable

///T4 Macro Fuanction/
#define T3_TIMER()     {T3_CT = 0;} //timer3 work as timer
#define T3_COUNTER()   {T3_CT = 1;} //timer3 work as counter
#define T3_TCLK12T()   {T3x12 = 0;} //set timer clk cycle time to 12 tmes system clk cycle time
#define T3_TCLK1T()    {T3x12 = 1;} //set timer clk cycle time to system clk cycle time
#define T3_INTENABLE() {ET3 = 1;}   //timer3 INT enable
#define T3_INTDISABLE() {ET3 = 0;}  //timer3 INT disable
#define T3_START()   {T3R = 1;}     //timer3 start
#define T3_STOP()   {T3R = 0;}      //timer3 stop
#define T3_WAITOVERFLOW(){while(!T3IF); T3R = 0; T3IF = 0; } //wait timer3 conter register overflow
#define T3_CLKOUTENABLE() {T3CLKO = 1;}    //timer3 clk output enable
#define T3_CLKOUTDISABLE() {T3CLKO = 0;}   //timer3 clk output disable
#define T3_CLKOUTSELP05() {T3T4PS = 0;}   //select P05 as clk output pin
#define T3_CLKOUTSELP01() {T3T4PS = 1;}   //select P01 as clk output pin

对比较复杂的设置就用函数实现,对延时、时钟输出、波特率发生器等相关函数我做了如下声明:

///T0//
/**********************************************************************
Function: T0CounterEnable(BOOL able); 
Return value: void
able: T0 work as counter enable/disable, 1: enable, 0: disable(as timer)
Discription: configure T0 work as counter/timer
Example:
  T0CounterEnable(1);  //T0 work as conter
    T0CounterEnable(0);  //T0 work timer
***********************************************************************/
void T0CounterEnable(BOOL able);


/**********************************************************************
Function: T0ModeConfigure(TIMER_MODE mode); 
Return value: void
mode: T0 work mode AL_16: auto_load 16bit, NAL_16: 16bit no auto load, AL_8: 8bit auto_load,
USAL_16: 16bit auto_load unsheilded
Discription: configure T0 work mode
Example:
 T0ModeConfigure(AL16);   //T0 work at auto_load 16bit
***********************************************************************/
void T0ModeConfigure(TIMER_MODE mode);

/**********************************************************************
Function: T0PreLoad(ui16 loadValue); 
Return value: void
loadValue: load value
Discription: preload T0 counter register
Example:
  T0PreLoad(1156);   
***********************************************************************/
void T0PreLoad(ui16 loadValue);

/**********************************************************************
Function: T0Delay1uSInit(); 
Return value: void
Discription: T0 delay 1uS  init
Example:
 T0Delay1uSInit();  
***********************************************************************/
void T0Delay1uSInit();

/**********************************************************************
Function: T0Delay10uSInit(); 
Return value: void
Discription: T0 delay 10uS  init
Example:
 T0Delay10uSInit();  
***********************************************************************/
void T0Delay10uSInit(); 

/**********************************************************************
Function: T0Delay1mSInit(); 
Return value: void
Discription: T0 delay 1mS  init
Example:
 T0Delay1mSInit();  
***********************************************************************/
void T0Delay1mSInit();

/**********************************************************************
Function: T0Delay10mSInit(); 
Return value: void
Discription: T0 delay 10mS  init
Example:
 T0Delay10mSInit();  
***********************************************************************/
void T0Delay10mSInit();

/**********************************************************************
Function: T0Delay100mSInit(); 
Return value: void
Discription: T0 delay 100mS  init
Example:
 T0Delay10mSInit(F30MHz);  
***********************************************************************/
void T0Delay100mSInit();

/**********************************************************************
Function: T0Delay1SInit(); 
Return value: void
Discription: T0 delay 1S  init
Example:
 T0Delay1SInit();  
***********************************************************************/
void T0Delay1SInit();

/**********************************************************************
Function: T0PusleOutInit(ui32 outFr); 
Return value: void
outFr: output clk frequency
Discription: T0 control pusle out init
Example:
 T0PusleOutInit(1000);  
***********************************************************************/
void T0PusleOutInit(ui32 outFr); 

/**********************************************************************
Function: T0ClkOutInit(ui32 outFr); 
Return value: void
outFr: output clk frequency
Discription: T0 divide sclk fruency out init
Example:
 T0PusleOutInit(1000);  
***********************************************************************/
void T0ClkOutInit(ui32 outFr); //T0 CLKO at P35


///T1//
/**********************************************************************
Function: T1CounterEnable(BOOL able); 
Return value: void
able: T1 work as counter enable/disable, 1: enable, 0: work as timer
Discription: configure T1 work as counter/timer
Example:
  T1CounterEnable(1);  //T1 work as conter
    T1CounterEnable(0);  //T1 work timer
***********************************************************************/
void T1CounterEnable(BOOL able);


/**********************************************************************
Function: T1ModeConfigure(TIMER_MODE mode); 
Return value: void
mode: timer mode of T0 work at 
Discription: configure T1 work mode
Example:
 T1ModeConfigure(AL_16);   //T1 work at auto_load 16bi
***********************************************************************/
void T1ModeConfigure(TIMER_MODE mode);

/**********************************************************************
Function: T1PreLoad(ui16 loadValue); 
Return value: void
loadValue: load value
Discription: preload T1 counter register
Example:
  T1PreLoad(1156);   
***********************************************************************/
void T1PreLoad(ui16 loadValue);

/**********************************************************************
Function: T1Delay1uSInit(); 
Return value: void
Discription: T1 delay 1uS  init
Example:
 T1Delay1uSInit();  
***********************************************************************/
void T1Delay1uSInit();

/**********************************************************************
Function: T1Delay10uSInit(); 
Return value: void
Discription: T1 delay 10uS  init
Example:
 T1Delay10uSInit();  
***********************************************************************/
void T1Delay10uSInit(); 

/**********************************************************************
Function: T1Delay1mSInit(); 
Return value: void
Discription: T1 delay 1mS  init
Example:
 T1Delay1mSInit();  
***********************************************************************/
void T1Delay1mSInit();

/**********************************************************************
Function: T1Delay10mSInit(); 
Return value: void
Discription: T1 delay 10mS  init
Example:
 T1Delay10mSInit();  
***********************************************************************/
void T1Delay10mSInit();


/**********************************************************************
Function: T1Delay100mSInit(); 
Return value: void
Discription: T1 delay 100mS  init
Example:
 T1Delay100mSInit();  
***********************************************************************/
void T1Delay100mSInit();

/**********************************************************************
Function: T1Delay1SInit(); 
Return value: void
Discription: T1 delay 1S  init
Example:
 T1Delay1SInit();  
***********************************************************************/
void T1Delay1SInit();

/**********************************************************************
Function: T1PusleOutInit(ui32 outFr); 
Return value: void
outFr: ouput pusle frequence
Discription: T1 control pusle out init
Example:
 T1PusleOutInit(1000);  
***********************************************************************/
void T1PusleOutInit(ui32 outFr); 

/**********************************************************************
Function: T1ClkOutInit(ui32 outFr); 
Return value: void
outFr: frequency of output pusle
Discription: T1 divide sclk fruency out init
Example:
 T1PusleOutInit(1000);  
***********************************************************************/
void T1ClkOutInit(ui32 outFr); //T1 CLKO at P34

/**********************************************************************
Function: T1BrOutInit(ui32 outFr); 
Return value: void
outFr: baudrate
Discription: T1 as baudrate generator init
Example:
 T1BrOutInit(9600);  
***********************************************************************/
void T1BrOutInit(ui32 outFr); 


///T2/
/**********************************************************************
Function: T2CounterEnable(BOOL able); 
Return value: void
able: T2 work as counter enable/disable, 1: work as counter, 0: work as timer
Discription: configure T2 work as counter/timer
Example:
  T2CounterEnable(1);  //T2 work as conter
    T2CounterEnable(0);  //T2 work timer
***********************************************************************/
void T2CounterEnable(BOOL able);

/**********************************************************************
Function: T2PreLoad(ui16 loadValue); 
Return value: void
loadValue: load value
Discription: preload T2 counter register
Example:
  T2PreLoad(1156);   
***********************************************************************/
void T2PreLoad(ui16 loadValue);

/**********************************************************************
Function: T2Delay1uSInit(); 
Return value: void
Discription: T2 delay 1uS  init
Example:
 T2Delay1uSInit();  
***********************************************************************/
void T2Delay1uSInit();

/**********************************************************************
Function: T2Delay10uSInit(); 
Return value: void
Discription: T2 delay 10uS  init
Example:
 T0Delay10uSInit();  
***********************************************************************/
void T2Delay10uSInit(); 

/**********************************************************************
Function: T2Delay1mSInit(); 
Return value: void
fsclk: system clk frequency
Discription: T2 delay 1mS  init
Example:
 T2Delay1mSInit();  
***********************************************************************/
void T2Delay1mSInit();

/**********************************************************************
Function: T2Delay10mSInit(); 
Return value: void
fsclk: system clk frequency
Discription: T2 delay 10mS  init
Example:
 T2Delay10mSInit();  
***********************************************************************/
void T2Delay10mSInit();

/**********************************************************************
Function: T2Delay100mSInit(); 
Return value: void
fsclk: system clk frequency
Discription: T2 delay 100mS  init
Example:
 T2Delay100mSInit();  
***********************************************************************/
void T2Delay100mSInit();

/**********************************************************************
Function: T2Delay1SInit(); 
Return value: void
fsclk: system clk frequency
Discription: T2 delay 1S  init
Example:
 T2Delay1SInit();  
***********************************************************************/
void T2Delay1SInit();

/**********************************************************************
Function: T2PusleOutInit(ui32 outFr); 
Return value: void
outFr: frequency of output pusle
Discription: T2 control pusle out init
Example:
 T2PusleOutInit(1000);  
***********************************************************************/
void T2PusleOutInit(ui32 outFr); 

/**********************************************************************
Function: T2ClkOutInit(ui32 outFr); 
Return value: void
outFr: fequency of output clk
Discription: T2 divide sclk fruency out init
Example:
 T2PusleOutInit(1000);  
***********************************************************************/
void T2ClkOutInit(ui32 outFr); //T2 CLKO at P30

/**********************************************************************
Function: T2BrOutInit(ui32 outFr); 
Return value: void
fsclk: system clk frequency
outFr: baudrate
Discription: T2 as baudrate generator init
Example:
 T2BrOutInit(9600);  
***********************************************************************/
void T2BrOutInit(ui32 outFr); 


///T3/
/**********************************************************************
Function: T3CounterEnable(BOOL able); 
Return value: void
able: T3 work as counter enable/disable, 1: work as counter, 0: work as timer
Discription: configure T3 work as counter/timer
Example:
  T3CounterEnable(1);  //T3 work as conter
    T3CounterEnable(0);  //T3 work timer
***********************************************************************/
void T3CounterEnable(BOOL able);

/**********************************************************************
Function: T3PreLoad(ui16 loadValue); 
Return value: void
loadValue: load value
Discription: preload T3 counter register
Example:
  T3PreLoad(1156);   
***********************************************************************/
void T3PreLoad(ui16 loadValue);

/**********************************************************************
Function: T3Delay1uSInit(fsclk); 
Return value: void
Discription: T3 delay 1uS  init
Example:
 T3Delay1uSInit();  
***********************************************************************/
void T3Delay1uSInit();

/**********************************************************************
Function: T3Delay10uSInit(fsclk); 
Return value: void
Discription: T3 delay 10uS  init
Example:
 T3Delay10uSInit();  
***********************************************************************/
void T3Delay10uSInit(); 

/**********************************************************************
Function: T3Delay1mSInit(); 
Return value: void
Discription: T3 delay 1mS  init
Example:
 T2Delay1mSInit();  
***********************************************************************/
void T3Delay1mSInit();

/**********************************************************************
Function: T3Delay10mSInit(); 
Return value: void
Discription: T3 delay 10mS  init
Example:
 T3Delay10mSInit();  
***********************************************************************/
void T3Delay10mSInit();

/**********************************************************************
Function: T3Delay100mSInit(); 
Return value: void
Discription: T3 delay 100mS  init
Example:
 T3Delay100mSInit();  
***********************************************************************/
void T3Delay100mSInit();

/**********************************************************************
Function: T3Delay1SInit(); 
Return value: void
Discription: T3 delay 1S  init
Example:
 T3Delay1SInit();  
***********************************************************************/
void T3Delay1SInit();

/**********************************************************************
Function: T3PusleOutInit(ui32 outFr); 
Return value: void
outFr: frequency of output pusle
Discription: T3 control pusle out init
Example:
 T3PusleOutInit(1000);  
***********************************************************************/
void T3PusleOutInit(ui32 outFr); 

/**********************************************************************
Function: T3ClkOutInit(ui32 outFr); 
Return value: void
outFr: frequency of output clk
Discription: T3 divide sclk fruency out init
Example:
 T3PusleOutInit(1000);  
***********************************************************************/
void T3ClkOutInit(ui32 outFr); //T3 CLKO at P04

/**********************************************************************
Function: T3BrOutInit(ui32 outFr); 
Return value: void
outFr: baudrate
Discription: T3 as baudrate generator init
Example:
 T3BrOutInit(9600);  
***********************************************************************/
void T3BrOutInit(ui32 outFr); 


///T4/
#define T4_TIMER()     {T4_CT = 0;}
#define T4_COUNTER()   {T4_CT = 1;}
#define T4_TCLK12T()   {T4x12 = 0;}
#define T4_TCLK1T()    {T4x12 = 1;}
#define T4_INTENABLE() {ET4 = 1;}
#define T4_INTDISABLE() {ET4 = 0;}
#define T4_START()   {T4R = 1;}
#define T4_STOP()   {T4R = 0;}
#define T4_WAITOVERFLOW(){while(!T4IF); T4R = 0; T4IF = 0; }
#define T4_CLKOUTENABLE() {T4CLKO = 1;}
#define T4_CLKOUTDISABLE() {T4CLKO = 0;}
#define T4_CLKOUTSELP07() {T3T4PIN = 0;}
#define T4_CLKOUTSELP03() {T3T4PIN = 1;}

/**********************************************************************
Function: T4CounterEnable(BOOL able); 
Return value: void
able: 1-T4 work as counter, 0-T4 work as timer
Discription: configure T4 work as counter/timer
Example:
  T4CounterEnable(1);  //T4 work as conter
    T4CounterEnable(0);  //T4 work timer
***********************************************************************/
void T4CounterEnable(BOOL able);

/**********************************************************************
Function: T4PreLoad(ui16 loadValue); 
Return value: void
loadValue: load value
Discription: preload T4 counter register
Example:
  T4PreLoad(1156);   
***********************************************************************/
void T4PreLoad(ui16 loadValue);

/**********************************************************************
Function: T4Delay1uSInit(); 
Return value: void
Discription: T4 delay 1uS  init
Example:
 T4Delay1uSInit();  
***********************************************************************/
void T4Delay1uSInit();

/**********************************************************************
Function: T4Delay10uSInit(); 
Return value: void
Discription: T4 delay 10uS  init
Example:
 T4Delay10uSInit();  
***********************************************************************/
void T4Delay10uSInit(); 

/**********************************************************************
Function: T4Delay1mSInit(); 
Return value: void
Discription: T4 delay 1mS  init
Example:
 T4Delay1mSInit();  
***********************************************************************/
void T4Delay1mSInit();

/**********************************************************************
Function: T4Delay10mSInit(); 
Return value: void
Discription: T4 delay 10mS  init
Example:
 T4Delay10mSInit();  
***********************************************************************/
void T4Delay10mSInit();

/**********************************************************************
Function: T4Delay100mSInit(); 
Return value: void
Discription: T4 delay 10mS  init
Example:
 T4Delay100mSInit();  
***********************************************************************/
void T4Delay100mSInit();

/**********************************************************************
Function: T4Delay1SInit(); 
Return value: void
Discription: T4 delay 1S  init
Example:
 T4Delay1SInit();  
***********************************************************************/
void T4Delay1SInit();

/**********************************************************************
Function: T4PusleOutInit(ui32 outFr); 
Return value: void
outFr: frequency of output pusle
Discription: T4 control pusle out init
Example:
 T4PusleOutInit(1000);  
***********************************************************************/
void T4PusleOutInit(ui32 outFr); 

/**********************************************************************
Function: T4ClkOutInit(ui16 outFr); 
Return value: void
outFr: frequency of output clk
Discription: T4 divide sclk fruency out init
Example:
 T4PusleOutInit(1000);  
***********************************************************************/
void T4ClkOutInit(ui32 outFr); //T4 CLKO at P06

/**********************************************************************
Function: T4BrOutInit(ui32 outFr); 
Return value: void
outFr: baudrate
Discription: T4 as baudrate generator init
Example:
 T4BrOutInit(9600);  
***********************************************************************/
void T4BrOutInit(ui32 outFr); 

函数的源代码如下:

/*STC32G_Timer.c
  Designed by Bill Liu
  Version 0.0 
  Modified last by Bill Liu on 07/11/2022
*/

#include    "STC32G_Timer.h"
#include "STC32G_INT.h"

///T0//
//**********************************************************************
void T0CounterEnable(BOOL able)
{
  TF0 = 0;
  if(able)
        T0_CT = 1;
  else
        T0_CT = 0;
}
//End of T0CounterEnable(BOOL able)

//**********************************************************************
void T0ModeConfigure(TIMER_MODE mode)
{
  ui8 tem = TMOD;
  TF0 = 0;
  ReplaceBits(&tem,1,0,mode);
  TMOD = tem;
}
//End of T0ModeConfigure(TIMER_MODE mode)

//**********************************************************************
void T0PreLoad(ui16 loadValue)
{
  TL0 = loadValue;
  TH0 = loadValue >> 8;
}
//End of T0PreLoad(ui16 loadValue)

//**********************************************************************
void T0Delay1uSInit()
{
  ui16 tem;
  T0_TIMER();
    ET0 = 0; //INT disable
    TF0 = 0;
  T0MODE_NAL16();
  T0_TCLK1T(); //T0 fclk at FOSC
  tem = FOSC / 1000000;
    tem = 65536 - tem;
  T0PreLoad(tem);
}
//End of T0Delay1uSInit() 

//**********************************************************************
void T0Delay10uSInit()
{
  ui16 tem;
  T0_TIMER();
    ET0 = 0; //INT disable
    TF0 = 0;
  T0MODE_NAL16();
  T0_TCLK1T();           //T0 fclk at FOSC
  tem = FOSC / 100000;
    tem = 65536- tem;
  T0PreLoad(tem);
}
//End of T0Delay10uSInit()

//**********************************************************************
void T0Delay1mSInit()
{
  ui16 tem;
  T0_TIMER();
    ET0 = 0; //INT disable
    TF0 = 0;
  T0MODE_NAL16();
  T0_TCLK12T();        //T0 fclk is FOSC/12
    tem = FOSC / 12 / 1000;
  tem = 65536- tem;
  T0PreLoad(tem);
}
//End of T0Delay1mSInit()

//**********************************************************************
void T0Delay10mSInit()
{
    ui16 tem;
  T0_TIMER();
    ET0 = 0; //INT disable
    TF0 = 0;
  T0MODE_NAL16();
  T0_TCLK12T();          //T0 fclk is FOSC/12
  tem = FOSC / 12 /100;
  tem = 65536- tem;
  T0PreLoad(tem);
}
//End of T0Delay10mSInit()

//***********************************************************************/
void T0Delay100mSInit()
{
    ui16 tem;
    //SysInit();
  T0_TIMER();
    ET0 = 0; //INT disable
    TF0 = 0;
  T0MODE_NAL16();
  T0_TCLK12T();         //T0 fclk is FOSC/12
    TM0PS = 0xFF; //pe-divide frequency 256
  tem = FOSC / 12 /10 /256;
  tem = 65536- tem;
  T0PreLoad(tem);
}
//End of T0Delay100mSInit()

//***********************************************************************/
void T0Delay1SInit()
{
    ui16 tem;
    //SysInit();
  T0_TIMER();
    ET0 = 0; //INT disable
    TF0 = 0;
  T0MODE_NAL16();
  T0_TCLK12T();          //T0 fclk is FOSC/12
    TM0PS = 0xFF; //pe-divide frequency 256
  tem = FOSC / 12 / 256;
  tem = 65536- tem;
  T0PreLoad(tem);
}
//End of T0Delay1SInit()


//**********************************************************************
void T0PusleOutInit(ui32 outFr)
{
    ui16 tem;
  T0_TIMER();
    ET0 = 0; //INT disable
    TF0 = 0;
  T0MODE_AL16();
    if(outFr <= FOSC / 65535)
    {
        AUXR &= ~0x80;        //T0 fclk is FOSC/12
        tem = FOSC / outFr / 24;
    }
    else
    {
        AUXR |= 0x80; 
        tem = FOSC/ outFr / 2;
  }
    tem = 65536-tem;
  T0PreLoad(tem);
}
//End of T0PusleOutInit(ui32 outFr)

//**********************************************************************
void T0ClkOutInit(ui32 outFr) //T0 CLKO at P35
{
    ui16 tem;
  T0_TIMER();
    ET0 = 0; //INT disable
    TF0 = 0;
  T0MODE_AL16();
    T0_CLKOUTENABLE();               //T0 clk out enable
    T0_INTDISABLE();      //T0 INT disable
    if(outFr <= FOSC / 65535)
    {
        T0_TCLK12T();         //T0 fclk is FOSC/12
        tem = FOSC / outFr / 24;
    }
    else
    {
        T0_TCLK1T();         //T0 fclk is FOSC
        tem = FOSC / outFr / 2;
  }
    tem = 65536-tem;
  T0PreLoad(tem);
}
//End of T0ClkOutInit(ui32 outFr)


///T1//
//**********************************************************************
void T1CounterEnable(BOOL able)
{
    TF1 = 0;
  if(able)
   T1_CT = 1;
  else
    T1_CT = 0;
}
//End of T1CounterEnable(BOOL able)

//**********************************************************************
void T1ModeConfigure(TIMER_MODE mode)
{
    ui8 tem = TMOD;
  TF1 = 0;
  ReplaceBits(&tem,5,4,mode);
  TMOD = tem;
}
//End of T1ModeConfigure(TIMER_MODE mode)

//**********************************************************************
void T1PreLoad(ui16 loadValue)
{
    TL1 = loadValue;
  TH1 = loadValue >> 8;
}
//End of T1PreLoad(ui16 loadValue)

//**********************************************************************
void T1Delay1uSInit()
{
    ui16 tem;
  T1_TIMER();
    ET1 = 0; //INT disable
    TF1 = 0;
  T1MODE_NAL16();
  T1_TCLK1T();         //T1 clk is FOSC
  tem = FOSC / 1000000;
    tem = 65536 - tem;
  T1PreLoad(tem);
}
//End of T1Delay1uSInit()

//**********************************************************************
void T1Delay10uSInit()
{
    ui16 tem = 0;
    //ui16 tem;
  T1_TIMER();
    ET1 = 0; //INT disable
    TF1 = 0;
  T1MODE_NAL16();
  T1_TCLK1T();          //T1 fclk is FOSC
  tem = FOSC / 100000;
    tem = 65536 - tem;
  T1PreLoad(tem);
} 
//End of T1Delay10uSInit()

//**********************************************************************
void T1Delay1mSInit()
{
    ui16 tem = 0;
  T1_TIMER();
    ET1 = 0; //INT disable
    TF1 = 0;
  T1MODE_NAL16();
  T1_TCLK12T();           //T1 fclk is FOSC/12
  tem = FOSC / 1000 / 12;
  tem = 65536-tem;
  T1PreLoad(tem);
}
//End of T1Delay1mSInit()

//**********************************************************************
void T1Delay10mSInit()
{
    ui16 tem;
  T1_TIMER();
    ET1 = 0; //INT disable
    TF1 = 0;
  T1MODE_NAL16();
  T1_TCLK12T();           //T1 fclk is FOSC/12
  tem = FOSC/100/12;
  tem = 65536-tem;
  T1PreLoad(tem);
}
//End of T1Delay10mSInit()

//**********************************************************************
void T1Delay100mSInit()
{
    ui16 tem;
    //SysInit();
    TM1PS = 0xFF;
  T1_TIMER();
    ET1 = 0; //INT disable
    TF1 = 0;
  T1MODE_NAL16();
  T1_TCLK12T();           //T1 fclk is FOSC/12
  tem = FOSC/10 / 12 /256;
  tem = 65536-tem;
  T1PreLoad(tem);
}
//End of T1Delay100mSInit()

//**********************************************************************
void T1Delay1SInit()
{
    ui16 tem;
    //SysInit();
    TM1PS = 0xFF;
  T1_TIMER();
    ET1 = 0; //INT disable
    TF1 = 0;
  T1MODE_NAL16();
  T1_TCLK12T();          //T1 fclk is FOSC/12
  tem = FOSC / 12 /256;
  tem = 65536-tem;
  T1PreLoad(tem);
}
//End of T1Delay1SInit()

//**********************************************************************
void T1PusleOutInit(ui32 outFr)
{
    ui16 tem;
  T1_TIMER();
    ET1 = 0; //INT disable
    TF1 = 0;
  T1MODE_AL16();
    if(outFr <= FOSC/65535)
    {
        T1_TCLK12T();         //T1 fclk is FOSC/12
        tem = FOSC/outFr/24;
    }
    else
    {
        T1_TCLK1T();         //T1 fclk is FOSC
        tem = FOSC/outFr/2;
  }
    tem = 65536-tem;
  T1PreLoad(tem);
}
//End of T1PusleOutInit(ui32 outFr)

//**********************************************************************
void T1ClkOutInit(ui32 outFr) //T1 CLKO at P34
{
    ui16 tem;
  T1_TIMER();
    ET1 = 0; //INT disable
    TF1 = 0;
  T1MODE_AL16();
    T1_CLKOUTENABLE();               //T1 clk out enable
    T1_INTDISABLE();      //T1 INT disable
    if(outFr <= FOSC / 65535)
    {
        T1_TCLK12T();          //T1 fclk is FOSC/12
        tem = FOSC/outFr/24;
    }
    else
    {
        T1_TCLK1T();           //T1 fclk is FOSC
        tem = FOSC/outFr/2;
  }
    tem = 65536-tem;
  T1PreLoad(tem);
}
//End of T1ClkOutInit(ui32 outFr)

//**********************************************************************
void T1BrOutInit(ui32 outFr)
{
    ui16 tem;
  T1_TIMER();
    ET1 = 0; //INT disable
    TF1 = 0;
  T1MODE_AL16();
    STC_IntT1Init(0, 0);      //T1 INT disable
    T1_TCLK1T();             //T1 fclk is FOSC
    tem = FOSC/outFr/4;
    tem = 65536 - tem;
    T1PreLoad(tem);
    SMOD = 0;           //baudrate undouble
    TR1 = 1;                  //T1 start
}
//End of T1BrOutInit(ui32 outFr)


///T2/
//**********************************************************************
void T2CounterEnable(BOOL able)
{
  if(able)
        T2_CT = 1;  //T2 as counter
  else
        T2_CT = 0;//T2 as timer
}
//End of T2CounterEnable(BOOL able)

//**********************************************************************
void T2PreLoad(ui16 loadValue)
{
    T2L = loadValue;
    T2H = loadValue >> 8;
}
//End of T2PreLoad(ui16 loadValue)

//**********************************************************************
void T2Delay1uSInit()
{
    ui16 tem;
  T2_TIMER();
    ET2 = 0;        //INT disable
    T2IF = 0;
  T2_TCLK1T();    //T2 clk is FOSC
    tem = FOSC / 1000000;
    tem = 65536 - tem;
  T2PreLoad(tem);
}
//End of T2Delay1uSInit()

//**********************************************************************
void T2Delay10uSInit()
{
    ui16 tem;
  T2_TIMER();
    ET2 = 0;        //INT disable
    T2IF = 0;
  T2_TCLK1T();    //T2 clk is FOSC
    tem = FOSC / 100000;
    tem = 65536 - tem;
  T2PreLoad(tem);
}
//End of T2Delay10uSInit()

//**********************************************************************
void T2Delay1mSInit()
{
    ui16 tem;
  T2_TIMER();
    ET2 = 0;        //INT disable
    T2IF = 0;
  T2_TCLK12T();  //T2 clk is FOSC/12
    tem = FOSC / 1000 /12;
    tem = 65536 -tem;
  T2PreLoad(tem);
}
//End of T2Delay1mSInit(ui32 FOSC)

//**********************************************************************
void T2Delay10mSInit()
{
    ui16 tem;
  T2_TIMER();
    ET2 = 0;        //INT disable
    T2IF = 0;
  T2_TCLK12T();  //T2 clk is  FOSC/12
    tem = FOSC / 100 /12;
    tem = 65536 -tem;
  T2PreLoad(tem);
}
//End of T2Delay10mSInit()

//**********************************************************************
void T2Delay100mSInit()
{
    ui16 tem;
  T2_TIMER();
    ET2 = 0;        //INT disable
    T2IF = 0;
    //SysInit();
    TM2PS = 0xFF;
  T2_TCLK12T(); //T2 clk is  FOSC/12
    tem = FOSC / 10 / 12 /256;
    tem = 65536 -tem;
  T2PreLoad(tem);
}
//End of T2Delay100mSInit()

//**********************************************************************
void T2Delay1SInit()
{
    ui16 tem;
  T2_TIMER();
    ET2 = 0;        //INT disable
    T2IF = 0;
    //SysInit();
    TM2PS = 0xFF;
  T2_TCLK12T(); //T2 clk is  FOSC/12
    tem = FOSC / 12 /256;
    tem = 65536 -tem;
  T2PreLoad(tem);
}
//End of T2Delay1SInit()

//**********************************************************************
void T2PusleOutInit(ui32 outFr)
{
    ui16 tem;
  T2_TIMER();
    ET2 = 0;        //INT disable
    T2IF = 0;
    if(outFr <= FOSC/65535)
    {
        T2_TCLK12T();               //T2 clk is FOSC/12
        tem = FOSC / outFr / 24;
    }
    else
    {
        T2_TCLK1T();                //T2 clk is FOSC
        tem = FOSC / outFr / 2;
  }
    tem = 65536-tem;
  T2PreLoad(tem);
} 
//End of T2PusleOutInit(ui32 outFr)

//**********************************************************************
void T2ClkOutInit(ui32 outFr) //T2 CLKO at P30
{
    ui16 tem;
  T2_TIMER();
    ET2 = 0;        //INT disable
    T2IF = 0;
    INTCLKO |= 0x01 < 2;               //T2 clk out enable
    STC_IntT2Init(0);      //T2 INT disable
    if(outFr <= FOSC/65535)
    {
        T2_TCLK12T();            //T2 clk is FOSC/12
        tem = FOSC / outFr / 24;
    }
    else
    {
        T2_TCLK1T();              //T2 clk is FOSC
        tem = FOSC / outFr / 2;
  }
    tem = 65536-tem;
  T2PreLoad(tem);
}
//End of T2ClkOutInit(ui32 outFr)

//**********************************************************************
void T2BrOutInit(ui32 outFr)
{
    ui16 tem;
  T2_TIMER();
    ET2 = 0;        //INT disable
    T2IF = 0;                                //T2 INT disable
    T2_TCLK1T();             //T2 clk at FOSC
    tem = FOSC / outFr / 4;
  tem = 65536 -tem;    
    T2PreLoad(tem);
    SMOD = 0;           //baudrate undouble
    T2R = 1; //T2 start
}
//End of T2BrOutInit(ui32 outFr)


///T3/
//**********************************************************************
void T3CounterEnable(BOOL able)
{
     if(able)
    T3_CT = 1;
  else
   T3_CT = 0;
}
//End of T3CounterEnable(BOOL able)

//**********************************************************************
void T3PreLoad(ui16 loadValue)
{
    T3L = loadValue;
    T3H = loadValue >> 8;
}
//End of T3PreLoad(ui16 loadValue)

//**********************************************************************
void T3Delay1uSInit()
{
    ui16 tem;
  T3_TIMER();
    ET3 = 0;        //INT disable
    T3IF = 0;
  T3_TCLK1T();    //T3 fclk is FOSC
  tem = FOSC / 1000000;
    tem = 65536 - tem;
  T3PreLoad(tem);
}
//End of T3Delay1uSInit()

//**********************************************************************
void T3Delay10uSInit()
{
    ui16 tem;
  T3_TIMER();
    ET3 = 0;        //INT disable
    T3IF = 0;
  T3_TCLK1T();     //T3 fclk is FOSC
  tem = FOSC / 100000;
    tem = 65536 - tem;
  T3PreLoad(tem);
}
//End of T3Delay10uSInit()

//**********************************************************************
void T3Delay1mSInit()
{
    ui16 tem;
  T3_TIMER();
    ET3 = 0;        //INT disable
    T3IF = 0;
  T3_TCLK12T(); //T3 fclk is FOSC/12
    tem = FOSC / 1000 /12;
    tem = 65536 -tem;
  T3PreLoad(tem);
}
//End of T3Delay1mSInit()

//**********************************************************************
void T3Delay10mSInit()
{
    ui16 tem;
  T3_TIMER();
    ET3 = 0;        //INT disable
    T3IF = 0;
  T3_TCLK12T(); //T3 fclk is FOSC/12
  tem = FOSC / 100 /12;
    tem = 65536 -tem;
  T3PreLoad(tem);
}
//End of T3Delay10mSInit()

//**********************************************************************
void T3Delay100mSInit()
{
    ui16 tem;
  T3_TIMER();
    ET3 = 0;        //INT disable
    T3IF = 0;
    //SysInit();
    TM3PS = 0xFF;
  T3_TCLK12T(); //T3 fclk is FOSC/12
  tem = FOSC / 10 / 12 / 256;
    tem = 65536 -tem;
  T3PreLoad(tem);
}
//End of T3Delay100mSInit()


//**********************************************************************
void T3Delay1SInit()
{
    ui16 tem;
  T3_TIMER();
    ET3 = 0;        //INT disable
    T3IF = 0;
    //SysInit();
    TM3PS = 0xFF;
  T3_TCLK12T(); //T3 fclk is FOSC/12
  tem = FOSC / 12 / 256;
    tem = 65536 -tem;
  T3PreLoad(tem);
}
//End of T3Delay1SInit()

//**********************************************************************
void T3PusleOutInit(ui32 outFr)
{
    ui16 tem;
  T3_TIMER();
    ET3 = 0;        //INT disable
    T3IF = 0;
    if(outFr <= FOSC/65535)
    {
        T3_TCLK12T();       //T3 fclk is FOSC/12
        tem = FOSC/outFr/24;
    }
    else
    {
        T3_TCLK1T();       //T3 fclk is FOSC
        tem = FOSC/outFr/2;
  }
    tem = 65536-tem;
  T3PreLoad(tem);
}
//End of T3PusleOutInit(ui16 outFr)

//**********************************************************************
void T3ClkOutInit(ui32 outFr) //T3 CLKO at P04
{
    ui16 tem;
  T3_TIMER();
    ET3 = 0;        //INT disable
    T3IF = 0;
    T3_CLKOUTENABLE();               //T3 clk out enable
    T3_INTDISABLE();      //T3 INT disable
    if(outFr <= FOSC/65535)
    {
        T3_TCLK12T();       //T3 fclk is FOSC/12
        tem = FOSC/outFr/24;
    }
    else
    {
        T3_TCLK1T();   //T3 fclk is FOSC
        tem = FOSC/outFr/2;
  }
    tem = 65536-tem;
  T3PreLoad(tem);
}
//End of T3ClkOutInit(ui16 outFr)

//**********************************************************************
void T3BrOutInit(ui32 outFr)
{
    ui16 tem;
  T3_TIMER();
    ET3 = 0;        //INT disable
    T3IF = 0;
    T3_INTDISABLE();      //T3 INT disable
    T3_TCLK1T();             //T3 clk at FOSC
    tem = FOSC / outFr / 4;
  tem = 65536 -tem;
    T3PreLoad(tem);
    SMOD = 0;           //baudrate undouble
    T3_START(); //T3 start
}
//End of T3BrOutInit(ui16 outFr)

///T4/
//**********************************************************************
void T4CounterEnable(BOOL able)
{
     if(able)
    T4_CT = 1;
  else
    T4_CT = 0;
}
//End of T4CounterEnable(BOOL able)

//**********************************************************************
void T4PreLoad(ui16 loadValue)
{
    T4L = loadValue;
    T4H = loadValue >> 8;
}
//End of T4PreLoad(ui16 loadValue)

//**********************************************************************
void T4Delay1uSInit()
{
    ui16 tem;
    ET4 = 0;        //INT disable
    T4IF = 0;
  T4_TIMER();
  T4_TCLK1T();    //T4 fclk is FOSC
  tem = FOSC/1000000;
    T4PreLoad(tem);
}
//End of T4Delay1uSInit()

//**********************************************************************
void T4Delay10uSInit()
{
    ui16 tem;
  T4_TIMER();
    ET4 = 0;        //INT disable
    T4IF = 0;
  T4_TCLK1T();     //T4 fclk is FOSC
  tem = FOSC/100000;
    tem = 65536-tem;
  T4PreLoad(tem);
} 
//End of T4Delay10uSInit(ui32 FOSC)

//**********************************************************************
void T4Delay1mSInit()
{
    ui16 tem;
  T4_TIMER();
    ET4 = 0;        //INT disable
    T4IF = 0;
  T4_TCLK12T();      //T4 fclk is FOSC/12
  tem = FOSC / 1000 /12;
    tem = 65536 -tem;
  T4PreLoad(tem);
}
//End of T4Delay1mSInit()

//**********************************************************************
void T4Delay10mSInit()
{
    ui16 tem;
  T4_TIMER();
    ET4 = 0;        //INT disable
    T4IF = 0;
  T4_TCLK12T(); //T4 fclk is FOSC/12
  tem = FOSC / 100 /12;
    tem = 65536 -tem;
  T4PreLoad(tem);
}
//End of T4Delay10mSInit()

//**********************************************************************
void T4Delay100mSInit()
{
    ui16 tem;
  T4_TIMER();
    ET4 = 0;        //INT disable
    T4IF = 0;
    //SysInit();
    TM4PS = 0xFF;
  T4_TCLK12T(); //T4 fclk is FOSC/12
  tem = FOSC / 10 / 12 / 256;
    tem = 65536 -tem;
    PCON &= ~0x80;            //baudrate undouble
  T4PreLoad(tem);
}
//End of T4Delay100mSInit()

//**********************************************************************
void T4Delay1SInit()
{
    ui16 tem;
  T4_TIMER();
    ET4 = 0;        //INT disable
    T4IF = 0;
    //SysInit();
    TM4PS = 0xFF;
  T4_TCLK12T(); //T4 fclk is FOSC/12
  tem = FOSC / 12 / 256;
    tem = 65536 -tem;
  T4PreLoad(tem);
}
//End of T4Delay1SInit()

//**********************************************************************
void T4PusleOutInit(ui32 outFr)
{
    ui16 tem;
  T4_TIMER();
    ET4 = 0;        //INT disable
    T4IF = 0;
    T4_INTDISABLE();
    if(outFr <= FOSC/65535)
    {
        T4_TCLK12T();         //T4 fclk is FOSC/12
        tem = FOSC/outFr/24;
    }
    else
    {
        T4_TCLK1T();          //T4 fclk is FOSC
        tem = FOSC/outFr/2;
  }
    tem = 65536-tem;
  T4PreLoad(tem);
}
//End of T4PusleOutInit(ui32 FOSC, ui32 outFr)

//**********************************************************************
void T4ClkOutInit(ui32 outFr) //T4 CLKO at P06
{
    ui16 tem;
  T4_TIMER();
    T4IF = 0;
    ET4 = 0;        //INT disable
    T4_CLKOUTENABLE()               //T4 clk out enable      
    if(outFr <= FOSC/65535)
    {
        T4_TCLK12T(); //T4 fclk is FOSC/12
        tem = FOSC/outFr/24;
    }
    else
    {
        T4_TCLK1T();  //T4 fclk is FOSC
        tem = FOSC/outFr/2;
  }
    tem = 65536-tem;
  T4PreLoad(tem);
}
//End of T4ClkOutInit(ui32 outFr) 

//**********************************************************************
void T4BrOutInit(ui32 outFr)
{
    ui16 tem;
  T4_TIMER();
    T4IF = 0;
    ET4 = 0;        //INT disable
    T4T3M |= 0x02;             //T4 fclk is FOSC
    tem = FOSC / outFr / 4;
  tem = 65536 -tem;
    T4PreLoad(tem);
    T4_INTDISABLE();
    T4_START();                                 //T4 start
}
//End of T4BrOutInit(ui32 outFr) 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/172614.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【Flink】浅谈Flink背压问题(1)

概述 在多线程的情况下有一个典型的模&#xff0c;型生产者消费者模型&#xff0c;该模型主要由生产者、消费者和一个大小固定的队列组成。生产者向队列发送数据&#xff0c;消费者从队列中取出数据并处理。 针对上述模型&#xff0c;如果队列属于有限长度&#xff0c;当消费者…

UE5执行Python脚本插件

1.启用UE5的Python脚本编辑器&#xff1a; 在Edit里面找到Plugins&#xff0c;然后打开插件管理器&#xff0c;搜索Python,找到 Python Editor Script Plugin并启用它。该插件也可能会自动启用&#xff08;至少我的UE5是这样的&#xff09;&#xff0c;如果已经自动启用&#…

python机器学习(一)算法学习的步骤、机器学习的应用及流程(获取数据、特征工程、模型、模型评估)

机器学习入门 机器学习中需要理论性的知识&#xff0c;如数学知识为微积分(求导过程&#xff0c;线性回归的梯度下降法)&#xff0c;线性代数(多元线性回归&#xff0c;高纬度的数据&#xff0c;矩阵等)&#xff0c;概率论(贝叶斯算法)&#xff0c;统计学(贯穿整个学习过程)&a…

Nginx使用(五)配置高可用集群示例

一、条件&#xff08;1&#xff09;需要两台Nginx服务器&#xff08;2&#xff09;需要keepalived&#xff08;3&#xff09;需要虚拟ip二、准备工作&#xff08;1&#xff09;需要两台服务器&#xff08;2&#xff09;在两台服务器安装nginx&#xff08;3&#xff09;在两台服…

Linux应用基础与实训小结

✅作者简介&#xff1a;热爱国学的Java后端开发者&#xff0c;修心和技术同步精进。 &#x1f34e;个人主页&#xff1a;Java Fans的博客 &#x1f34a;个人信条&#xff1a;不迁怒&#xff0c;不贰过。小知识&#xff0c;大智慧。 &#x1f49e;当前专栏&#xff1a;Java案例分…

ElasticSearch安装及基本使用

文章目录0. 学习资料1. 概念2. 安装ESdocker安装1. **下载镜像**2. **创建实例**3. **浏览器访问&#xff1a;**4. 测试使用Kibana安装1. 下载镜像2. 创建实例3. 效果3. 检索_cat保存查询通过id查询乐观锁操作更新删除批量操作**导入测试数据**4. 进阶搜索基本检索参考文档基本…

将数据从Java Bean复制到另一个Java Bean

JavaBean复制的几种方式1&#xff1a;概述在实际编程过程中&#xff0c;我们常常要遇到这种情况&#xff1a;有一个对象A&#xff0c;在某一时刻A中已经包含了一些有效值&#xff0c;此时可能 会需要一个和A完全相同新对象B&#xff0c;并且此后对B任何改动都不会影响到A中的值…

P2T: Pyramid Pooling T ransformer for Scene Understanding

论文链接&#xff1a; https://arxiv.org/abs/2106.12011 中文版本&#xff1a; https://mmcheng.net/wp-content/uploads/2022/08/22PAMI_P2T_CN.pdf 代码链接&#xff1a; https://github.com/yuhuan-wu/P2T P2T: Pyramid Pooling T ransformer for Scene Understanding一、摘…

2023年网络安全比赛--JavaScript安全绕过中职组(超详细)

一、竞赛时间 180分钟 共计3小时 二、竞赛阶段 1.使用渗透机场景kali中工具扫描服务器,将服务器上apache版本号作为flag提交; 2.使用渗透机场景windows7访问服务其场景中的网站(网站路径为IP/javascript),找到网站首页中flag并提交; 3.使用渗透机场景windows7根据第二题的…

2. 拍照的基础知识

1. 单反相机的全称为单镜头反光相机 单反相机的原理就体现在“单”和“反”上&#xff0c;单字就是单镜头&#xff0c;就是说单反相机只能安装一个镜头&#xff0c;光线或是影像通过单反镜头进行来取景的。 对于“反”来说就是相机系统内部有一个反光板。光线通过单反镜头投射…

你应该知道的 7 个最受欢迎的 Python 机器学习库

2023年你应该知道的 7 个最受欢迎的 Python 机器学习库 33/100 发布文章 weixin_38037405 未选择任何文件 new 有一句谚语“你不必重新发明轮子”&#xff0c;工具库就是最好的例子。它可以帮助您以简单的方式编写复杂且耗时的功能。在我看来&#xff0c;一个好的项目会使用一些…

LeetCode分类刷题----字符串篇

字符串字符串1.反转字符串344.反转字符串541.反转字符串||2.替换空格剑指offer05.替换空格3.翻转字符串里的单词151.反转字符串里的单词4.左旋转字符串剑指 Offer 58 - II. 左旋转字符串5.实现strStr函数()28.实现strStr()函数6.重复的子字符串459.重复的子字符串字符串 1.反转…

YOLOv1学习笔记

来源&#xff1a;投稿 作者&#xff1a;ΔU 编辑&#xff1a;学姐 论文笔记 《You Only Look Once:Unifified, Real-Time Object Detection》 Joseph Redmon∗ , Santosh Divvala∗†, Ross Girshick , Ali Farhadi∗† University of Washington∗ , Allen Institute for A…

【JavaGuide面试总结】计算机网络·上

【JavaGuide面试总结】计算机网络上1.OSI 七层模型是什么&#xff1f;每一层的作用是什么&#xff1f;2.TCP/IP 四层模型是什么&#xff1f;每一层的作用是什么&#xff1f;应用层传输层网络层网络接口层3.应用层有哪些常见的协议&#xff1f;4.为什么网络要分层&#xff1f;5.…

数据分析方法与模型

文章目录1 数据分析1.1 占比分析1.2 趋势分析1.3 对比分析1.4 象限分析1.5 排名分析1.6 维度分析2 分析模型2.1 费米问题-大致估算2.2 七问分析法-思考角度的拓展2.3 互联网通用模型AARRR、八角分析法2.3.1 AARRR2.3.2 游戏化用户增长策略-八角模型本文来源&#xff0c;为接地气…

基于RMI技术的数据库操作中间件设计 综合实践报告

前言 1.1 实践目的和要求 为了将理论用于实践,巩固所学知识,提高自己发现问题并用所学知识分析问题和解决问题的能力,锻炼自己的工作能力,适应社会能力,自我管理能力,了解目前软件的应用情况,需求情况,发展方向及前景。 要求&#xff1a; 要求在实习过程中认真学习技术知…

[疑难杂症2023-002]不就是Move一个文件吗,怎么会有这么多坑呢?

本文由Markdown语法编辑器编辑完成&#xff0e; 1. 前言: 近期在项目中遇到一个需求&#xff0e; 背景是&#xff0c;在一个QT封装的C/S架构的软件中&#xff0c;一个报告的预览页面&#xff0c;是由QT封装了QWebWidget, 里面放着一个网页&#xff0e;这个网页通过调用一定的…

论文解读 TOOD: Task-aligned One-stage Object Detection

github: https://github.com/fcjian/TOOD paper: https://arxiv.org/pdf/2108.07755.pdf 关键点 思考起点 指出传统one-stage算法在在优化目标分类和定位问题中的不足&#xff08;DecoupledHead分离了分类任务和回归任务[yolox表示解耦这是优点&#xff0c;yolo1-5都是使用y…

[oeasy]python0054_三引号_原样显示字符串_triple_quoted

三引号 回忆上次内容 \ 首先是转义字符 可以 和别的字符 构成转义序列 \a是 ␇ (bell),\b 退回一格\t 水平制表符\v、\f LineFeed\\ 输出 \\" 输出 "\ 输出 \xhh 通过 16 进制数值转义\nnn 通过 8 进制数值转义\ 还是 续行字符 放在 行尾可以让 下一行和本行 连成一…

Linux2

4.Linux的文件系统4.1.linux中所有的一切都是文件万事万物皆文件windows是盘符&#xff0c;linux是树windows是\&#xff08;翘&#xff09;linux是/4.2.查找文件方式&#xff1a;1. 绝对路径 有/2. 相对路径 4.3.挂载&#xff1a;执行挂载命令&#xff1a;mount 设备文件名 挂…