If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
p->CapFlag = EvaRegs.EVAIFRC.all; // Save capture flag register, convenient for Watch Window ##########EVAIFRC的2~0位控制cap1,2,3复位与否######### if (p->CapFlag==0) // NO_EDGE_DETECTED: No hall signal edges detected on CAP1-3 (bits 0-2) #################CAP1-3 (bits 0-2),其他位保留,要是读取则为0###################### { p->CmtnTrigHall = 0; // Reset trigger, it only handshakes with calling program. if (p->EdgeDebounced==0) // If motor has not moved then debounce current position. { F281X_EV1_HALL3_Debounce(p); p->CmtnTrigHall = p->EdgeDebounced; // Set Commutation trigger here } else // If current position is debounced, find match in table F281X_EV1_HALL3_Next_State_Ptr(p); // and return pointer to current state. Ptr to be incremented // by MOD6CNT after RET.
p->EdgeDebounced = 0; // Reset trigger } else // EDGE_DETECTED: Any hall signal edges detected on CAP1-3 { p->StallCount = 0xFFFF; // On new edge, reset stall counter EvaRegs.EVAIFRC.all = 0x0007; // Clear all CAP1-3 Int-flags #############################复位cap1~3######################## F281X_EV1_HALL3_Determine_State(p); // Since motor has moved, determine state (read HallGpio) p->CapCounter += 1; // Increment running edge detection counter }
各位大佬们好,我的问题是:不是检测是否边沿时,NO则调用debounce函数,那么不是if (p->CapFlag==0) 这句判断边沿与否吗?if (p->CapFlag==0) 这句 if (p->EdgeDebounced==0)又有什么作用呢,不是很理解EdgeDebounced==0是什么意思?