« Return to Thread: Getting Variables

Getting Variables

by wjhurst :: Rate this Message:

Reply to Author | View in Thread

As an outline to the problem Im trying to solve. Im generating a PWM input to a DC fan which is controlling a ball in a tube and using a sonic sensor as my feedback device.

Part of this control, requires me to model the motor. So for this Im just inputting random pwm values and saving the data both in an array

Im using the following bits of code

int i;
int sensor_data[1000];
int pwm_rand[1000];

void main(void){

for (i=0;i<1000;i++){

temp = rand()%50+50; //random number between 50 and 100
PWMDTY0=temp;
pwm_rand[i]=temp; // save value for PWM
sensor_data[i]=get_sensor_value(); // store sensor value in an array
}
}

When using Codewarriors True Time simulator after making this and running it, in the data window, I can see each array filled with the values I need.

However I am unable to just copy & paste this. I only need results from a handful of trials, but it would be too tedius to manually type out several thousand points.

Im not sure if this is due to the free version I am using at school, or if there is another way to basically get my values in the arrays to even notepad or a txt file where I can then do more math with it.

Thanks.

 « Return to Thread: Getting Variables