Go to Post Just make a FIRST version of Quidditch. The only people who would be complaining are drivers from previous years who wanted to play it. - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 14-01-2006, 22:36
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 746
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Loop time for OperatorControl function? Debug blows...

What is the loop time for OperatorControl function?

I wrote a program to figure this out myself, but then I couldn't even figure that out because I remembered how difficult it was to even try and debug with these PIC controllers.

I don't have a background in PIC or C programming. But I can program. I normally program controllers like PLCs and other controllers that support online programming, and allows me to pause the controller, and check variables. (Break Points) So I learned in this controller, you can't do that. You have to debug using print statements to a terminal window. The problem I'VE ALWAYS HAD, is the print statements don't seem to me they EVER MATCH what the ACTUAL VARIBLE IS IN THE CONTROLLER.

For example, back to my problem, I started off with no timer and setting a variable called count = count +1 in the OperatorControl function, then slapping a PrinttoScreen "count" variable. Last I remember this controller does a loop every 26.2ms. So I put an IF statement, if count >= to 38, then print another statement. I assumed I would see this print statement every 1 second in my terminal.....I don't.....it’s faster than that….

So I decided to use the EasyC timer, it support milliseconds, so I set my If statement to if timer >= 1000, then print to screen...yah...it works...But now the same problem I have every single year with the printF or now print-to-screen, is that it doesn't seem like the variable that is being printed is actually what my variable is inside the controller, or is it?

See ZIP attached. This simple timing program should capture and measure the loop time of OperatorControl function and print that information to screen for me, instead every time the print-to-screen prints the variable count to screen, it increments 1,2,3,4,5, hits about 16, then it jumps to 1568,1569,1570 to something like 1700, then finally enters the If statement, prints the count variable one final time, resets the timer, resets the count = 0, then starts all over.

Why, why, can't I ever get the 2004, 2005, 2006 controllers to DEBUG right? Why does my count variable count from 1 to 16, then jump up to 1500? What is wrong with my code? Am I using the printF statement incorrectly?

Finally, since I can't trust what print screen is telling me what my variable is, does anyone just know what the loop time of OperatorControl function loop time is? I think it's FASTER than 26.2ms per loop. The reason I want to know, is because I wrote another velocity function that is going to be part of a PID function I need to know my sampling time to pull this off. And within that function, it looks like it was executing fast, but I will never know, because I can't get the printF to work for me and stop lying about what the variables are in my program.

Can someone help set me straight?
Attached Files
File Type: zip test.zip (5.2 KB, 73 views)
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
variable? manodrum Programming 11 01-04-2003 17:20
Actual execution time measurement Dan Technical Discussion 5 24-03-2003 11:36
Solution to Timing Loops Steven Carmain Programming 39 10-02-2003 13:33
How long should production time be??? archiver 1999 4 23-06-2002 23:16
need help with time zone! Ken Leung General Forum 6 25-06-2001 12:44


All times are GMT -5. The time now is 13:30.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi