76 lines
3.3 KiB
C++
76 lines
3.3 KiB
C++
|
|
|||
|
/********************************** (C) COPYRIGHT *******************************
|
|||
|
* File Name : Main.C
|
|||
|
* Author : WCH
|
|||
|
* Version : V1.0
|
|||
|
* Date : 2017/01/20
|
|||
|
* Description : CH554 Time <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>T2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD>
|
|||
|
<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>жϴ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*******************************************************************************/
|
|||
|
#include "..\Public\CH554.H"
|
|||
|
#include "..\Public\Debug.H"
|
|||
|
#include "Timer.H"
|
|||
|
#include "stdio.h"
|
|||
|
|
|||
|
#pragma NOAREGS
|
|||
|
|
|||
|
UINT8 FLAG;
|
|||
|
UINT16 Cap[8] = {0};
|
|||
|
|
|||
|
main( )
|
|||
|
{
|
|||
|
CfgFsys( ); //CH554ʱ<34><CAB1>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
mDelaymS(5); //<2F><EFBFBD><DEB8><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>ʱ<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>Ƶ<EFBFBD>ȶ<EFBFBD>
|
|||
|
mInitSTDIO( ); //<2F><><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
printf("start ...\n");
|
|||
|
|
|||
|
|
|||
|
#ifdef T0_INT
|
|||
|
printf("T0 Test ...\n");
|
|||
|
mTimer0Clk12DivFsys(); //T0<54><30>ʱ<EFBFBD><CAB1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
mTimer_x_ModInit(0,2); //T0 <20><>ʱ<EFBFBD><CAB1>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>
|
|||
|
mTimer_x_SetData(0,0x5555); //T0<54><30>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ֵ
|
|||
|
mTimer0RunCTL(1); //T0<54><30>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
ET0 = 1; //T0<54><30>ʱ<EFBFBD><CAB1><EFBFBD>жϿ<D0B6><CFBF><EFBFBD>
|
|||
|
EA = 1;
|
|||
|
while(1);
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef T1_INT
|
|||
|
printf("T1 Test ...\n");
|
|||
|
mTimer1Clk12DivFsys(); //T1<54><31>ʱ<EFBFBD><CAB1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
mTimer_x_ModInit(1,2); //T1 <20><>ʱ<EFBFBD><CAB1>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>
|
|||
|
mTimer_x_SetData(1,0xEEEE); //T1<54><31>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ֵ
|
|||
|
mTimer1RunCTL(1); //T1<54><31>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
ET1 = 1; //T1<54><31>ʱ<EFBFBD><CAB1><EFBFBD>жϿ<D0B6><CFBF><EFBFBD>
|
|||
|
EA = 1;
|
|||
|
while(1);
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
#ifdef T2_INT
|
|||
|
printf("T2 Test ...\n");
|
|||
|
mTimer2ClkFsys(); //T2<54><32>ʱ<EFBFBD><CAB1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
mTimer_x_ModInit(2,0); //T2 <20><>ʱ<EFBFBD><CAB1>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>
|
|||
|
mTimer_x_SetData(2,0xAAAA); //T2<54><32>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ֵ
|
|||
|
mTimer2RunCTL(1); //T2<54><32>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
ET2 = 1; //T2<54><32>ʱ<EFBFBD><CAB1><EFBFBD>жϿ<D0B6><CFBF><EFBFBD>
|
|||
|
EA = 1;
|
|||
|
while(1);
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
#ifdef T2_CAP
|
|||
|
printf("T2_CAP Test ...\n");
|
|||
|
mTimer2ClkFsys(); //T2<54><32>ʱ<EFBFBD><CAB1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
mTimer_x_SetData(2,0); //T2 <20><>ʱ<EFBFBD><CAB1>ģʽ<C4A3><CABD><EFBFBD>ò<EFBFBD>ģʽ
|
|||
|
CAP2Init(1); //T2 CAP2<50><32><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>
|
|||
|
CAP1Init(1); //T2 CAP2<50><32><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>
|
|||
|
mTimer2RunCTL(1); //T2<54><32>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
ET2 = 1; //T2<54><32>ʱ<EFBFBD><CAB1><EFBFBD>жϿ<D0B6><CFBF><EFBFBD>
|
|||
|
EA = 1;
|
|||
|
while(1);
|
|||
|
#endif
|
|||
|
|
|||
|
while(1);
|
|||
|
}
|