View unanswered posts | View active topics It is currently Fri Dec 19, 2014 9:23 pm






Reply to topic  [ 4 posts ] 
Time tracking on pic microcontroller 
Author Message
Rookie

Joined: Wed Dec 05, 2012 11:00 am
Posts: 9
Post Time tracking on pic microcontroller
Can i time track with the PIC code?


Thu Jan 03, 2013 9:38 pm
Profile
Novice
User avatar

Joined: Sat Jul 10, 2010 3:06 pm
Posts: 86
Location: Roanoke, VA
Post Re: Time tracking on pic microcontroller
What is time tracking?

I'm sure you can, but it depends what you mean... :)

_________________
Check out my website! www.RoboDesigners.com

VRC Team 2190

Twitter: @RoboDesigners


Thu Jan 03, 2013 9:46 pm
Profile WWW
Rookie

Joined: Wed Dec 05, 2012 11:00 am
Posts: 9
Post Re: Time tracking on pic microcontroller
For instance, i move my robot forward and and start clocking its time. Then when it decides to turn I can check the time it moved forward. This is what I mean by time tracking.


Thu Jan 03, 2013 9:56 pm
Profile
Novice
User avatar

Joined: Sat Jul 10, 2010 3:06 pm
Posts: 86
Location: Roanoke, VA
Post Re: Time tracking on pic microcontroller
Yes, this is possible using a component of ROBOTC called a timer. You may want to read this wiki page: http://www.robotc.net/wiki/VEX2_Functions_Timing

Here's an example of how this could be done:
Code:
task main() {
  ClearTimer(T1); //Clear the number 1 timer.

  driveForward(); //Some function that drives forward and decides when to stop.

  int timeUntilTurn = time1[T1]; //Stores the current value of the timer (in milliseconds)

  turn(); //Proceeds to turn.
}


This assumes you have two subroutines called driveForward() and turn(), and that driveForward decides when to stop. At the end of the program, the time from starting to drive forward until the turn is stored in the variable timeUntilTurn.

_________________
Check out my website! www.RoboDesigners.com

VRC Team 2190

Twitter: @RoboDesigners


Thu Jan 03, 2013 10:04 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.