Should I outsource my counting to something external? Micros is too slow.


hello!

i have application lot of counting involved.  i'm measuring timing of event similar of chronograph measures speed of bullet.

i have 8 microsecond delay between each of these steps in code.

code: [select]

initmicros = micros();
nano2_data.ch1trigtime_rising = 0;
while(digitalread(ch1_trig) == high && !nano2_data.trigtimeout);
nano2_data.ch1trigtime_falling = (unsigned int)(micros() - initmicros);
while(digitalread(ch2_trig) == low && !nano2_data.trigtimeout);
nano2_data.ch2trigtime_rising = (unsigned int)(micros() - initmicros);
while(digitalread(ch2_trig) == high && !nano2_data.trigtimeout);
nano2_data.ch2trigtime_falling = (unsigned int)(micros() - initmicros);
while(digitalread(ch3_trig) == low && !nano2_data.trigtimeout);
nano2_data.ch3trigtime_rising = (unsigned int)(micros() - initmicros);
while(digitalread(ch3_trig) == high && !nano2_data.trigtimeout);
nano2_data.ch3trigtime_falling = (unsigned int)(micros() - initmicros);


i realize there lot of work i'm putting between things , can minimize 8 microseconds considerably doing math , unit conversion @ end (just store long integers , process them later).  still, i'm looking on order of 1us precision in timing.  don't how have sequence , if first "high" on ch1_trig doesn't happen, none of happens.

i'm thinking using external counters application.  i'm finding few i2c ones maxim makes.  have i2c because don't think support basic binary counter has 16+ pins in project.  none of ones i've seen have features i'm looking for.

ideally able setup 6 of these binary counters, each 1 looking different event (channel 1 - 3 , high , low).  there "start" pin and  "stop" pin.  arduino transmit "start" signal each counter simultaneously.  each of input signals tied corresponding "stop" pins.  @ end of "event" arduino download (via i2c) data each counter.

can give me pointers hardware might useful this?  thank you! 

this looks similar i'm looking for, slow.

http://datasheets.maximintegrated.com/en/ds/ds1683.pdf


Arduino Forum > Using Arduino > Project Guidance > Should I outsource my counting to something external? Micros is too slow.


arduino

Comments

Popular posts from this blog

Rasperry Wifi LAN Controller - Raspberry Pi Forums

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

Unlock car with bluetooth and car key