CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Routine execution time without timer?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
curt2go



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

Routine execution time without timer?
PostPosted: Tue Oct 08, 2019 10:30 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Oct 09, 2019 12:42 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Oct 09, 2019 8:21 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group