I know this may sound like a dumb question, but I am trying to find how long a routine takes, BUT its inside a DMA INT. sometimes its longer than others and when its shorter I don't want to run other routines that time through. A timer wont work inside the DMA INT so I was wondering is there some other way of knowing how long something is taking?
24EP256Gp206.
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Wed Oct 09, 2019 12:42 am
Set an i/o pin high at the start of the isr and set it low at the end.
Use a logic analyzer to catch it and measure it. Or use a scope to
if it occurs at a sufficiently frequent rate.
Or, you could read a timer at the start of the isr and again at the end
and subtract them to get the duration. Then store that value in a global
variable and display it later. Initialize the variable to 0. Only update it
inside the isr if it's 0. That way, you don't overwrite it in later interrupts
and can display it at any time in your main(). Or, you could save
successive duration values in a global array.
curt2go
Joined: 21 Nov 2003 Posts: 200
Posted: Wed Oct 09, 2019 8:21 am
I do the IO and logic analyzer idea when trying to see how long it takes outside the program. I actually thought of using the DMA register that shows which register its currently reading from. It’s a continuous DMA so when it first goes into the DMA I read it and then after it’s done I read it again and subtract the start value from that to get the duration. Since each DMA transfer in this case has certain timing I can figure out exactly how long it took.
Thank you for your suggestions. I appreciate the feedback.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum