SPRUJ28E November 2021 – September 2024 AM68 , AM68A , TDA4AL-Q1 , TDA4VE-Q1 , TDA4VL-Q1
// Code snippet for CAP mode Absolute Time, Rising edge trigger
// Run Time ( e.g. CEVT4 triggered ISR call)
//==========================================
TSt1 = ECAPxRegs.CAP1; // Fetch Time-Stamp captured at t1
TSt2 = ECAPxRegs.CAP2; // Fetch Time-Stamp captured at t2
TSt3 = ECAPxRegs.CAP3; // Fetch Time-Stamp captured at t3
TSt4 = ECAPxRegs.CAP4; // Fetch Time-Stamp captured at t4
Period1 = TSt2-TSt1; // Calculate 1st period
Period2 = TSt3-TSt2; // Calculate 2nd period
Period3 = TSt4-TSt3; // Calculate 3rd period