Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Counting LOOP time, in PIC

Status
Not open for further replies.

RuH_iranga

Junior Member level 3
Joined
Nov 4, 2010
Messages
31
Helped
7
Reputation
14
Reaction score
6
Trophy points
1,288
Location
sri lanka
Activity points
1,480
Hi
I need to count the loop time(start to end) in milliseconds for each endless loop cycle. I use 18f452 PIC and this loop time is finding to maintain constant loop time in endless loop. Please anyone can give an idea. then I can continue in implement it.

thanks
 

andre_teprom

Super Moderator
Staff member
Joined
Nov 7, 2006
Messages
9,221
Helped
1,147
Reputation
2,313
Reaction score
1,123
Trophy points
1,403
Location
Brazil
Activity points
53,677
I see 2 options :

1 ) Take a output pin to toogle each time you reach determined poit of program. The result measured at a Frequency-metter is half or real rate F/2.
2 ) If some Timer is still avaliable you can use it to perform account. Once an overflow occurs you must toogle an output pin. The result measured at a Frequency-metter is half of real rate multupyed by Timer magnitude (F/2)*(M). 256 to 8-bit / 65.536 to 16-bit.

+++
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
another technique is to display some start text, execute the test code 1000 times (or more) and display some end text. Using a stopwatch measure the time between the display of the start and end text. You have the overhead of the loop but can meaure that without the test code and subtract it.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top