Go to Post *wonders if omni wheel rollers come in MOE green or have to be dyed* - EricH [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
  #11   Spotlight this post!  
Unread 19-02-2004, 12:11
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Programming Help

Quote:
Originally Posted by shsdragon
{
static long timeCounter = 0; //this will count the number of 26.2ms ticks that have passed

while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */

if(timeCounter <= 115) //3 seconds / 26.2ms = 114.5
{
pwm13 = pwm15 = 30;
}
else if(timeCounter <= 134) //we'll give the relays about .5 seconds to switch
{
pwm13 = pwm15 = 0;
relay1_fwd = relay2_fwd = 1;
}
else
{
//put stuff to do after the other things here
//you can also add more else-if statements to time other things
}

Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
timeCounter++; //add one to the tick count
}
}
}

this should work fine - hope it helps!


mmy motoors don't move
shs, i already sent you a PM answering that question that you PMed me before you posted it here - check your PMs. but in the name of simplicity...

you need to add a call to Generate_Pwms() after the Putdata() line, like this:
Code:
void User_Autonomous_Code(void)
{
  static long timeCounter = 0; //this will count the number of 26.2ms ticks that have passed

  while (autonomous_mode)   /* DO NOT CHANGE! */
  {
    if (statusflag.NEW_SPI_DATA)      /* 26.2ms loop area */
    {
        Getdata(&rxdata);   /* DO NOT DELETE, or you will be stuck here forever! */

        if(timeCounter <= 115) //3 seconds / 26.2ms = 114.5
        {
             pwm13 = pwm15 = 30;
        }
        else if(timeCounter <= 134) //we'll give the relays about .5 seconds to switch
        {
             pwm13 = pwm15 = 0;
             relay1_fwd = relay2_fwd = 1;
        }
        else
        {
             //put stuff to do after the other things here
             //you can also add more else-if statements to time other things
        }

        Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
        Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
        timeCounter++; //add one to the tick count
    }
  }
}
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
 


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
Programming Compatition Angela06 Programming 30 08-04-2005 23:12
A few questions on programming the Control System Avarik Control System 21 08-02-2004 11:42
Pneumatics electrical wiring and programming archiver 2001 1 23-06-2002 23:10
Error found in programming for the pump and pressure switch sjharobotics Programming 4 06-02-2002 17:46
pbasic programming punarhero Programming 4 21-01-2002 23:32


All times are GMT -5. The time now is 00:03.

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