Go to Post OMG are you saying we are going to have a question mark game element next, that would be crazy - Greg Needel [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
  #2   Spotlight this post!  
Unread 14-02-2008, 12:19
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,809
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Programing delays in MPLAB

There is no single function through MPLAB, but there are several ways to accomplish what you want. The simplest is to just use a count of the slow radio packet loops as an approximation of time.
Here's an example.

Code:
#define HOW_LONG 38                //38 = 1 second, e.g., 76 = 2 seconds
static int counter=0;
 
if (counter < HOW_LONG)
{
    counter++;
    // Drive at half speed
    pwm01 = 127 - 60;
    pwm02 = 127 + 60;
}
else
{
    // Stop driving
    pwm01 = 127;
    pwm02 = 127;
}
Another method is to setup an internal clock, but that's more complex.
There's a white paper on understanding timers here: http://www.ifirobotics.com/docs/time...004-jan-14.pdf
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 14-02-2008 at 12:25.
 


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
WEATHER DELAYS!! Gamer930 General Forum 3 16-03-2007 21:44
"VENDORs", reasonable delays in shipping due to out of stock items, and other errata Madison General Forum 12 08-12-2006 18:14
[UFH]: October Unsung FIRST Heroes Delays Amanda Morrison Unsung FIRST Heroes 1 03-10-2005 00:51
using the MPLAB IDE MPLAB SIM simulator WizardOfAz Programming 1 03-11-2003 01:24
weather delays? archiver 2001 6 23-06-2002 22:11


All times are GMT -5. The time now is 18:06.

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