I'm now working on a LIN project with S12P64 and I want to set a timeout after the last SCI receiving interrupt to check if it's the end of the frame or not.
My idea is to set a timer counter after a SCI interrupt. If the timer counter achieve the expected value, so the timeout is reached and we can say that the frame is end. Else if a SCI interrupt occures before timeout, we reset the timer counter to ZERO in the SCI interrupt so that it will never reach the timeout if there is data arriving.
The problem is that I'm not familiar with the timer over flow, input capture and output compare. I think the input capture maybe not useful in my case so I decided to use output compare to calculate a single period after SCI interrupt. I succeded in setting an output compare to run a period task continuously but I don't know how to toggle the timer counter in the SCI interrupt, instead of toggling it automatically by itself. Maybe reset the counter in the SCI interrupt is a good idea, but I don't know which regist I can reset the counter to 0.
Can anyone help me about this?