- or else do i need to set two GPIO pins as EXTI with rising edge interrupt.
- i am already generating two waveforms with some dealy . But should i use Input capture method to capture the values at rising edge at each pulse and need to count the number of counts for every rising edge of both waveforms using interrupt using stm32f103. Based on those values i need to calculate powerfactor at zero crossing. This is my code
- i am going to set my flag as start counter=1;
- if(1==start counter) // if my flag is equal to 1 going to start the counter at each rising edge
- {
- do
- {
- __HAL_SET_COUNTER(&htim2, 0); // set counter to 0
- uint16_t count = __HAL_GET_COUNTER(&htim2); // these lines of code do i need to add in my IC calling function or in while loop
- count++;
- }while(__HAL_GET_COUNTER(&htim2)!=0) // if my flag is equal to 0 reset my counter
count =0; // i need to reset my counter
start counter=0;
- }
- should i need to to measure input capture value of both rising edges also because i need to calculate the powerfactor at zero crossing between two waveforms. If so were i need to add my code to measure input capture values. if my code has any mistake can you please suggest me with correct code of line i am really confused of it.
- Thank you