#include #include USER_TYPEDEF User; /** * @brief 过零点检测 * @data 2022/08/12 */ void ZeroCrossing_Init(void) { // ClrBit(P1_OE, P15); // config P20 as input // ClrBit(P1_PU, P15); // diasable P20 Pull Up // ClrBit(P1_AN, P15); // diasable P20 analog function // ClrBit(P1_IF, P15); // clear P11 interrupt flag // SetBit(P1_IE, P15); // config P11 as the source of EXTI1 // IT11 = 0; // IT10 = 0; // 00: posedge mode interrupt,01: negedge mode interrupt,1x: edge-change mode interrupt // PX11 = 0; // PX10 = 1; // 中断优先级别0,中断优先级最高 // EX1 = 1; // 使能外部中断1, P20位外部中断输入硬件 // EA = 1; // 使能全局中断 }