Go to Post I guess this is where theory vs reality comes into play. - PhilBot [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 21-09-2005, 21:02
Andrew Blair's Avatar
Andrew Blair Andrew Blair is offline
SAE Formula is FIRST with Gasoline.
FRC #0306 (CRT)
Team Role: Alumni
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Corry
Posts: 1,193
Andrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond repute
Send a message via AIM to Andrew Blair Send a message via Yahoo to Andrew Blair
Array problems( i think....)

I have recently been working on a copy cat program, and am just in the development stages, so right now i'm working on placing array values every program cycle from user input, then just replaying them. Right now i'm just putting the array values to ram (we don't have much code right now, so our ram is pretty much empty), then replaying them. Ultimately I plan to save them to eeprom by pressing a save button.

My problem is that the code compiles fine, but when the copycat is executed, I have no control and it blinks code error *almost* immediately. The way my code is set up, I have about 2 seconds of record time, and it dies about 2 seconds in. (I do intend to scale my code appropiately, so i'll have much more record time than that, but for right now it's fine recording a value every program cycle).


I warn you, what you are about to see is very crude and may shock you with blatent programming errors. I am actually expecting my array to be very screwed up, because i'm still learning how to use them.

Code:
unsigned char left_side[90];    
unsigned char left_side[90];
unsigned char right_side[90];

unsigned int i;


//record device, takes i variable(increases address every program loop), takes value from joystick input.

if (p2_sw_trig==1)
{
   i=0;
   i++;
while( i<90)
{
left_side[i]=p1_y;
right_side[i]=p2_y;
}

if (i<90)
{
  pwm01,pwm02=127;
}

}


//replay device, takes value from table and puts it to pwms

if ( p1_sw_trig==1)

{
i=0;
i++;
while(i<90)
{
pwm01=left_side[i];
pwm02=right_side[i];
}

if(i>90)
{
  pwm01=127;
  pwm02=127;
}

}


Thanks so much in advance! I hope I put that all down right. I just realized I didn't check the main processor anytime in that while loop. Could that my problem?
__________________
Reading makes a full man, conference a ready man, and writing an exact man.
-Sir Francis Bacon

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
-Albert Einstein
 


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
Array Problems: Possible<stdio.h> Alex Wijtowych Programming 7 26-01-2005 04:39
Robot Rodeo - fixing control problems Gary Dillard Off-Season Events 7 26-10-2004 00:46
Do you all have problems with.... Munkaboo Website Design/Showcase 19 03-03-2003 19:51
Joystick problems archiver 2001 3 24-06-2002 02:40


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

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