![]() |
Opengauge/MPGuino development: Freeduino signal processing
Here is what I put together to simulate a working signal processor. It *SHOULD* be possible to hook your soundcard output to the freeduino and come up with similiar readings. Hope HEX is ok, should be quicker than decimal, but I can live with decimal too.
Code:
//program to send dummy data over the serial port for prototyping the gui(s). 10D8A,25,0 1CC11,28,2 18E54,22,6 21CC3,33,A 24295,25,D 2AB8C,2B,F 181D7,30,12 28355,32,14 287F1,2A,16 2B03E,2E,19 1BBDC,31,19 2445B,26,1B 1D77E,25,1C E3A4,27,1D 9A4D,26,1C 9403,25,1C 9623,25,1C 91F9,24,1A 908E,22,1A 9116,21,19 9A09,20,18 F59F,20,17 1160B,1F,18 1193B,20,17 12D12,1F,18 173EF,20,18 15109,20,18 1269B,21,18 |
Quote:
Quote:
Quote:
My understanding is that external interrputs are handled by specific functions, not necessarily timers. so very rough sketch (assuming we can come up with micros()): Code:
unsigned long injHiMS |
Quote:
Quote:
Quote:
Quote:
Your code sketch lays things out pretty well. I think we should put the Injector pulse width in an array, then average the array before sending it to the Palm. Nevermind. I see you're totaling the microseconds. I'm working a river clean up this weekend, so I'll be offline. No coding or testing :( But I'll be camping and boating :) |
Quote:
1. on the start of a timed event, save microSeconds() 2. at the end of a timed event, call elapsedMicroSeconds(startMicroSeconds) It was a lot harder than it looks :) It digs into wiring.c and AVR, but it also demonstrates how simply the arduino integrates with them, once you know where to look. Quote:
I'm kind of tempted to say our main loop should be written like delay() with the loop guts in the middle, I used this technique below also, most things come back in 1000ms, a few were in 1001ms, don't know if a timer interrupt every second would actually be any more accurate with the other injector and vss interrupts going on. Quote:
Code:
/* 4,0,2304,7376,1000,1003852 4,1014,1020620,15556,1000,1002320 4,2026,2032344,15556,1000,1003324 4,3039,3045068,15556,1000,1003332 0,4051,4057808,15552,1000,1002288 0,5063,5069500,15556,1000,1002340 4,6075,6081244,15556,1000,1003320 4,7088,7093972,15556,1000,1003316 4,8100,8106692,15556,1000,1002328 4,9112,9118424,15556,1000,1003328 4,10125,10132196,17636,1000,1003348 4,11138,11144948,17636,1000,1003304 4,12150,12157652,17636,1000,1002308 0,13162,13169364,17636,1000,1003352 4,14175,14182124,17636,1000,1003336 4,15187,15194864,17636,1000,1002296 4,16199,16206564,17636,1000,1002308 4,17211,17218276,17636,1000,1003340 4,18224,18231020,17636,1000,1003328 4,19236,19243752,17636,1000,1002296 4,20248,20255452,17636,1000,1003348 4,21261,21268204,17636,1000,1003308 4,22274,22280916,17636,1000,1003348 4,23286,23293668,17636,1000,1002304 4,24298,24305372,17636,1000,1003340 4,25311,25318120,17636,1000,1003336 4,26323,26330860,17636,1000,1002300 4,27335,27342564,17636,1000,1002296 4,28347,28354264,17636,1000,1003328 4,29360,29366996,17636,1000,1003336 4,30372,30379736,17636,1000,1002320 4,31384,31391460,17636,1000,1003336 4,32397,32404200,17636,1000,1003336 4,33410,33416936,17640,1000,1003344 4,34422,34429684,17636,1000,1002288 4,35434,35441376,17636,1000,1003348 4,36447,36454128,17636,1000,1003296 4,37459,37466828,17636,1000,1002336 0,38471,38478564,17636,1000,1002300 4,39483,39490272,17636,1000,1003320 0,40496,40502996,17632,1000,1003332 4,41508,41515736,17636,1000,1002296 4,42520,42527436,17636,1000,1003356 0,43533,43540192,17636,1000,1003348 4,44546,44552944,17640,1000,1003332 |
putting it together
Code:
/* draft of signal processor for the opengauge project, untested |
Other notes:
1. the basic signal processor is 3458 bytes (of a 14336 byte maximum). If I take out any references to serial, it goes down to 1922 bytes. 2. the main loop is taking about 6 milliseconds, without any vss or injector interrupts, but with serial transmission of "0,0,0" before it waits for the second to be over. 3. it might be better to use microseconds to control the main loop or otherwise detect that the 9 hour millis rollover has occured and adjust accordingly, it should be able to run forever without breaking, not 9 hours. |
More notes:
Software might need to reject pulses that are too short, and/or disable pin 2 interrupts briefly after an injector pulse to filter out oscillations: http://www.ecomodder.com/forum/showt...9906#post19906 Cannot have both LOW and HIGH interrupts on same pin, need to utilize CHANGE interrupt somehow: http://www.ecomodder.com/forum/showt...9907#post19907 |
All times are GMT -4. The time now is 10:05 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com