下边是主程序的代码:
/* USER CODE BEGIN (0) */
#include "rti.h"
#include "gio.h"
#include "het.h"
#include "sci.h"
/* USER CODE END */
/* Include Files */
#include "sys_common.h"
#include "system.h"
/* USER CODE BEGIN (1) */
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
/* USER CODE END */
void main(void)
{
/* USER CODE BEGIN (3) */
hetSIGNAL_t CAP;
unsigned char a,b,c;
gioInit();
rtiInit();
hetInit();
sciInit();
rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
rtiEnableNotification(rtiNOTIFICATION_COMPARE1);
rtiEnableNotification(rtiNOTIFICATION_COMPARE2);
rtiEnableNotification(rtiNOTIFICATION_COMPARE3);
rtiStartCounter(rtiCOUNTER_BLOCK0);
_enable_IRQ();//开启中断
sciSendByte(sciREG2, 0);
CAP=capGetSignal(cap0);
a=(unsigned char)(CAP.duty);
sciSendByte(sciREG2, a);
sciSendByte(sciREG2, 0);
b=(unsigned char)(CAP.period/256);
c=(unsigned char)(CAP.period);
sciSendByte(sciREG2, b);
sciSendByte(sciREG2, c);
sciSendByte(sciREG2, 0);
while(1){
//capGetSignal(cap0);
}
/* USER CODE END */
}