Big array Data packaging .

Hi, all

i have big array filled with data. I am using arduino DUE board.

int arr[22000];

i want to transfer this array's data through serial or USB or Ethernet at quickest possible time.

at presently i am using for loop to read out each locations data of array. but i need to iterate for loop 22000 times its taking time. is there any way where i can pack this data together and send it to PC/Laptop using serial or ethernet etc.. and on the other end i will parse it .

kindly help me.

Thanks in advance.

What range of data values are being stored in the array ?
Is the array always filled with 22000 values that need to be transferred ?
Could the application support saving data to an SD card rather than to the array ?

data is in integer range only.its number only. the maximum size of data on each location can go upto 4 Bytes (32 bits) and minimum is 0. its not always 22000 array location filled with numbers. whenever there is no number it should gives 0 by accessing respective array location. for example array location 1 to 10 contains number but 11 to 15 has no number hence it is ZERO. but zero should not be ignored because each location represents the data whether it is numbers or zero. presently i am accessing it through serial port. each locaiton is printing on monitor and i am getting 22000 lines means ROWS. these data i am writing into text file and that text file is connected to excel sheet where i am pulling the latest by refreshing the excel sheet.

my problem is the data transmission of each location using for loop is taking arround 4 to 5 seconds depend upon data lengths all time not equal data lengths. and this 4 to 5 seconds is too big. so i am thinking to pack the array data together and send it over serial within 2 seconds if possible i do not know its possible or not.

once data stored in array after that i am transmitting over serial during acquisition i am not willing to transfer. so once data acquired and stored in array we can even make text file on board using SD card but again to send that file to PC is another headache for me. so looking for workable option.

hope you guys are now understand the problem.

What baud rate are you using for the Serial transfer ?

450000

I don't think that you are going to be able to pack the data in the array if, as you say

the maximum size of data on each location can go upto 4 Bytes (32 bits)

because there is no useful spare space in the array. The array is declared as an int and the smallest value that you store is zero so the sign bit is theoretically available but in practice it cannot be used in a meaningful way. Do you really need to store values with a range of between 0 and 2,147,483,647 ?

Where do the 22000 values come from and over what period ?
Could you possibly send them in batches, or even individually, as they are received ?

EJLED:
my problem is the data transmission of each location using for loop is taking arround 4 to 5 seconds depend upon data lengths all time not equal data lengths. and this 4 to 5 seconds is too big. so i am thinking to pack the array data together and send it over serial within 2 seconds if possible i do not know its possible or not.

I’d venture to guess that this time has nothing to do with using a ‘for’ loop and everything to do with something else in the code that you haven’t shown us.

BTW, in the English language, sentences start with the first word Capitalized.