bwgames
Joined: 21 Jul 2005 Posts: 36
|
Counter problems |
Posted: Wed Sep 06, 2006 2:33 am |
|
|
I have the below code to read from an EEPROM and output several lines at once (rather than having to read the EEPROM for each line which slows it down), yet I don't get any output apart from:
"j= "
Any ideas?
Code: |
int32 i;
int32 j;
int32 number;
char X_array[10];
char Y_array[10];
char Z_array[10];
....
number = 5000; //can change
i=0;
j=0;
do {
while((j<8)&&((i-7)<number))
{
X_array[j] = read_eeprom_byte(framWrite[0],framRead[0],addr+i);
Y_array[j] = read_eeprom_byte(framWrite[1],framRead[1],addr+i);
Z_array[j] = read_eeprom_byte(framWrite[2],framRead[2],addr+i);
j++;
i++;
}//end of if j<8
fprintf(Wireless,"\n\rj= %Lu\n\r",j); //debugging output
j=0;
while((j<8)&&((i-7)<number))
{
fprintf(Wireless,"%Lu,%i,%i,%i\n\r",(i-7),X_array[j],Y_array[j],Z_array[j]);
j++;
}
j=0;
delay_ms(100);
} while((i-7)<number);
|
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Wed Sep 06, 2006 8:31 am |
|
|
From the help file
Quote: | Note: All types, except float, by default are unsigned |
Thus int32 is unsigned.
you never enter while loop because
i=0
i-7=04294967289 //remember i is unsigned so subtraction wraps to a pos number
(i-7)<5000) fails |
|