You might find that the compiler will convert: temp_array1[0] = array1[0]; temp_array2[0] = array2[0]; .... temp_array1[15] = array1[15]; temp_array2[15] = array2[15]; directly into 32 MOVFF instructions. To get this to happen, you will probably have to make temp_arrayX global or static. Bob Ammerman RAm Systems ----- Original Message ----- From: "Bruce Partridge" To: Sent: Sunday, December 21, 2003 4:23 PM Subject: Re: [PIC:]Two low priority long tasks with several high priority short tasks. > This is the code I timed: > for (i=0; i<16; i++) > { > temp_array1[i] = array1[i]; > temp_array2[i] = array2[i]; > } > > All of the arrays are 32 bit float. > > I was quite surprised that it took so long. The above C code generates > about 70 instructions in assembler. With a 1 Mhz instruction clock, the > processor should execute about 15,000 instructions in 66 ms. Even going > through the loop 16 time shouldn't produce anywhere near that number of > instructions. > > I am starting to think that I could write an inline assembler routine that > would just move the contents without all the array addressing and stuff. On > an 18F4552, I should be able to expect the array contents to be contiguous. > > Bruce Partridge > http://www.rebreather.ca > > > It can't take 66ms just to *COPY* the arrays. You must be > > doing something else also. Couldn't you just clear GIE during > > the actual *copying* of the data, then re-enable GIE and go on > > doing that other stuff that probably takes the most part of the > > 66 ms, I guess. Just copying would at most be a number of MOVFF > > instructions, and at 4Mhz take the double number of microseconds > > (plus the GIE handling stuff). > > > > Jan-Erik. > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.543 / Virus Database: 337 - Release Date: 11/21/2003 > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body