00001 /* structs.h 00002 00003 Copyright 2008 Fred Cooke 00004 00005 This file is part of the FreeEMS project. 00006 00007 FreeEMS software is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 FreeEMS software is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with any FreeEMS software. If not, see <http://www.gnu.org/licenses/>. 00019 00020 We ask that if you make any changes to this file you send them upstream to us at admin@diyefi.org 00021 00022 Thank you for choosing FreeEMS to run your engine! */ 00023 00024 /* Header file multiple inclusion protection courtesy eclipse Header Template */ 00025 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */ 00026 #ifndef FILE_STRUCTS_H_SEEN 00027 #define FILE_STRUCTS_H_SEEN 00028 00029 00030 /* For noobs : http://www.space.unibe.ch/comp_doc/c_manual/C/SYNTAX/struct.html 00031 * http://en.wikipedia.org/wiki/Composite_type 00032 * http://www.cs.usfca.edu/~wolber/SoftwareDev/C/CStructs.htm 00033 * http://sandbox.mc.edu/~bennet/cs220/codeex/struct_c.html 00034 */ 00035 00036 00037 /* Naming should be in the singular form such that the instantiation can be the plural */ 00038 00039 00040 /* Types summary 00041 * 00042 * BEWARE : Be explicit!! 00043 * 00044 * char 8 bit (defaults to unsigned, but always specify signed/unsigned anyway) 00045 * short 16 bit (defaults to signed, but always specify signed/unsigned anyway) 00046 * int 16 bit DO NOT USE! (current compile flags make this 16 bits, but a change of flags could will change your program if you use this because they will all be 32 bit all of a sudden) 00047 * long 32 bit (defaults to signed, but always specify signed/unsigned anyway) 00048 * long long 64 bit (inefficient, avoid these, if using : defaults to signed, but always specify signed/unsigned anyway) 00049 * float 32 bit IEEE floating point numbers (inefficient, avoid these, used fixed point math) 00050 * double 64 bit IEEE floating point numbers (inefficient, avoid these, used fixed point math) 00051 */ 00052 00053 00054 // TODO 00055 // Status struct 00056 // Ignition struct 00057 // Injection struct 00058 // Engine position struct 00059 // Validity flags, or they should be in the status struct? 00060 00061 00062 typedef struct { 00063 char byte1; //8 bit 00064 short byte23; // 16 bit 00065 } tribyte; 00066 00067 00068 typedef struct { 00069 unsigned char RAMPage; 00070 unsigned char FlashPage; 00071 void* RAMAddress; 00072 void* FlashAddress; 00073 unsigned short size; 00074 } blockDetails; 00075 00076 // memory block addresses description parameters 00077 00078 00079 /* Fixed Configuration - place things that do not * 00080 * change after initial setup or during tuning here. */ 00081 #define FIXED_CONFIG1_SIZE sizeof(fixedConfig1) 00082 typedef struct { 00083 00084 /* Settings variables : 0 = false */ 00085 unsigned short coreSettingsA; /* Each bit represents the state of some core setting, masks below and above where the same one is used */ 00086 /* Bit masks for coreSettingsA */ // TODO needs a rename, as does coreStatusA 00087 //#define COREA1 BIT1_16 /* 1 */ 00088 #define PRIMARY_POLARITY BIT2_16 /* 2 1 = high teeth 0 = low teeth */ 00089 #define SECONDARY_POLARITY BIT3_16 /* 3 1 = high teeth 0 = low teeth */ 00090 //#define COREA4 BIT4_16 /* 4 */ 00091 //#define FUEL_CUT BIT5_16 /* 5 Remove injection completely */ 00092 //#define HARD_SPARK_CUT BIT6_16 /* 6 Remove ignition completely */ 00093 //#define SOFT_SPARK_CUT BIT7_16 /* 7 Remove ignition events round robin style */ 00094 //#define SPARK_RETARD BIT8_16 /* 8 Retard ignition in RPM dependent way */ 00095 #define STAGED_ON BIT9_16 /* 9 Whether we are firing the staged injectors */ 00096 #define STAGED_START BIT10_16 /* 10 1 = Fixed start 0 = Scheduled start */ 00097 #define STAGED_END BIT11_16 /* 11 1 = Fixed end 0 = Scheduled end */ 00098 //#define COREA12 BIT12_16 /* 12 */ 00099 //#define COREA13 BIT13_16 /* 13 */ 00100 //#define COREA14 BIT14_16 /* 14 */ 00101 //#define COREA15 BIT15_16 /* 15 */ 00102 //#define COREA16 BIT16_16 /* 16 */ 00103 00104 00105 /* Pre configured value settings for the sensor inputs */ 00106 unsigned short presetIAT; 00107 unsigned short presetCHT; 00108 unsigned short presetTPS; 00109 unsigned short presetEGO; 00110 unsigned short presetBRV; 00111 unsigned short presetMAP; 00112 unsigned short presetAAP; 00113 unsigned short presetMAT; 00114 unsigned short presetEGO2; 00115 unsigned short presetIAP; 00116 unsigned short presetBPW; /* Base Pulse Width */ 00117 unsigned short presetAF; /* Air Flow */ 00118 00119 00120 /* Fuel injection settings TODO duplication from original temp code below!! */ 00121 unsigned short perCylinderVolume; /* 500cc = 0.5l 0.5 * 32768 = pcv, so divide by 32768 go get litres */ 00122 unsigned short stoichiometricAFR; /* 34 for hydrogen, all others less, figure is 14.7 * 1024, divide by 1024 to get AFR */ 00123 unsigned short injectorFlow; /* Injector flow of 240cc/min / 60 is 4ml/second is multiplied by 1024, so divide by 1024 for ml/second, divide by 1000 for litres/second */ 00124 unsigned short densityOfFuelAtSTP; /* 703gm/litre for Octane. 32 * fuel density = number, divide by 32 for the real figure */ 00125 00126 /* Sensor related settings */ 00127 unsigned short TPSClosedMAP; 00128 unsigned short TPSOpenMAP; 00129 00130 00131 /* Sensor input conditioning settings */ 00132 /* These are used to calculate MAP, EGO and TPS from ADC readings. */ 00133 unsigned short MAPMinimum; /* 0 kPa usually. */ 00134 unsigned short MAPRange; /* 10000, 11500, 25000, 30000, 40000 etc (/100 for kPa) */ 00135 unsigned short AAPMinimum; /* 0 kPa usually. */ 00136 unsigned short AAPRange; /* 10000, 11500, 25000, 30000, 40000 etc (/100 for kPa) */ 00137 unsigned short EGOMinimum; /* 0.5 lambda ? (0.5 x 32768 = 16384) */ 00138 unsigned short EGORange; /* 1.5 lambda ? ((1.5 - 0.5) x 32768 = 32768 (max 49152)) */ 00139 unsigned short BRVMinimum; /* 0 Volts usually. */ 00140 unsigned short BRVRange; /* 24.5 Volts for 10k and 39k resistors on a 12v vehicle */ 00141 unsigned short TPSMinimumADC; /* *should* be zero, but often isn't, this value corresponds to 0% TPS */ 00142 unsigned short TPSMaximumADC; /* */ 00143 // unsigned short TPSADCRange; // ?? 100% = how many ADCs ? 00144 /*efine TPS_MINIMUM 0 ** = 0.00% For clarity ONLY, always zero. */ 00145 #define TPS_RANGE_MAX 64000 /* = 100.00% */ 00146 unsigned char userTextField[userTextFieldArrayLength1]; /* "Place your personal notes here!!" */ 00147 } fixedConfig1; 00148 00149 00150 /* Fixed Configuration - place things that do not * 00151 * change after initial setup or during tuning here. */ 00152 #define FIXED_CONFIG2_SIZE sizeof(fixedConfig2) 00153 typedef struct { 00154 00155 /* Setting variables (must be inited with useful values) */ 00156 unsigned short capacityOfAirPerCombustionEvent; /* How much air it swallows per power producing event */ 00157 unsigned short perPrimaryInjectorChannelFlowRate; /* How much fuel flows per minute per channel */ 00158 unsigned short perSecondaryInjectorChannelFlowRate; /* How much fuel flows per minute per channel */ 00159 unsigned short readingTimeout; /* How often an ADC reading MUST occur */ 00160 unsigned char ports; /* How many groups of injectors we are firing */ 00161 unsigned char coils; /* How many coils we are firing */ 00162 unsigned char combustionEventsPerEngineCycle; /* How many power producing events per engine cycle */ 00163 unsigned char revolutionsPerEngineCycle; /* Rotary = 1, 2 Stroke = 1, 4 Stroke = 2 */ 00164 unsigned char primaryTeeth; /* How many teeth are on the crank signal including the missing ones if any (eg. 36-1 primary = 36 not 35) */ 00165 unsigned char missingTeeth; /* Number sequentially removed from primary teeth (eg. 36-1 missing = 1) */ 00166 00167 /* Serial settings */ 00168 unsigned short baudDivisor; /* 22 = (40MHz / (16*115.2kHz)) = 21.7013889 */ 00169 unsigned char networkAddress; /* Default = 1, Default for PC = 10 */ 00170 00171 /* Tacho settings */ 00172 unsigned char tachoTickFactor; 00173 unsigned short tachoTotalFactor; 00174 00175 /* User text field for noting which installation the unit is from etc. */ 00176 unsigned char userTextField[userTextFieldArrayLength2]; /* "Place your personal notes here!!" */ 00177 } fixedConfig2; 00178 00179 00180 #define DERIVED_VARS_SIZE sizeof(DerivedVar) 00181 #define DERIVED_VARS_WIDTH IN_OUT_BANKS /* How many elements per array currently 2 at 25/6/08 */ 00182 #define DERIVED_VARS_UNIT 2 /* How large each element is in bytes (short = 2 bytes) */ 00183 /* Use this block to make it easy to manage the derived variables */ 00184 typedef struct { 00185 /* Calculated from core vars */ 00186 unsigned short LoadMain; /* Configurable unit of load */ 00187 // unsigned short LoadSecondary; 00188 00189 unsigned short VEMain; /* Divide by 512 to get % */ 00190 // unsigned short VESecondary; 00191 00192 unsigned short Lambda; /* Divide by 32768 to get Lamda */ 00193 unsigned short AirFlow; /* top half */ 00194 unsigned short densityAndFuel; /* bottom half */ 00195 00196 unsigned short BasePW; /* In timer ticks of 0.8us */ 00197 unsigned short IDT; /* 0.8us ticks */ 00198 unsigned short ETE; /* 0.8us ticks */ 00199 signed short TFCTotal; /* Transient fuel correction */ 00200 00201 unsigned short FinalPW; /* In timer ticks of 0.8us */ 00202 unsigned short RefPW; /* In timer ticks of 0.8us */ 00203 00204 unsigned short sp1; /* */ 00205 unsigned short sp2; /* */ 00206 unsigned short sp3; /* */ 00207 unsigned short sp4; /* */ 00208 unsigned short sp5; /* */ 00209 00210 // unsigned short ; /* */ 00211 } DerivedVar; 00212 00213 00214 #define RUNTIME_VARS_SIZE sizeof(RuntimeVar) 00215 #define RUNTIME_VARS_LENGTH 13 /* How many runtime vars */ 00216 #define RUNTIME_VARS_UNIT 2 /* How large each element is in bytes (short = 2 bytes) */ 00217 /* Use this block to manage the execution time of various functions loops and ISRs etc */ 00218 typedef struct { 00219 /* Engine position and RPM code runtimes */ 00220 unsigned short primaryInputLeadingRuntime; 00221 unsigned short primaryInputTrailingRuntime; 00222 unsigned short secondaryInputLeadingRuntime; 00223 unsigned short secondaryInputTrailingRuntime; 00224 00225 /* Mathematics runtimes */ 00226 unsigned short calcsRuntime; 00227 unsigned short genCoreVarsRuntime; 00228 unsigned short genDerivedVarsRuntime; 00229 unsigned short mathTotalRuntime; 00230 unsigned short mathSumRuntime; 00231 00232 unsigned short RTCRuntime; 00233 00234 /* */ 00235 unsigned short mainLoopRuntime; 00236 unsigned short logSendingRuntime; 00237 unsigned short serialISRRuntime; 00238 } RuntimeVar; 00239 00240 00241 #define ISR_LATENCY_VARS_SIZE sizeof(ISRLatencyVar) 00242 #define ISR_LATENCY_VARS_LENGTH 2 /* How many latency vars */ 00243 #define ISR_LATENCY_VARS_UNIT 2 /* How large each element is in bytes (short = 2 bytes) */ 00244 /* Use this block to manage the execution time of various functions loops and ISRs etc */ 00245 typedef struct { 00246 /* Engine position and RPM code latencies */ 00247 unsigned short primaryInputLatency; 00248 unsigned short secondaryInputLatency; 00249 00250 /* Injector latencies */ 00251 unsigned short Injector1Latency; 00252 unsigned short Injector2Latency; 00253 unsigned short Injector3Latency; 00254 unsigned short Injector4Latency; 00255 unsigned short Injector5Latency; 00256 unsigned short Injector6Latency; 00257 00258 unsigned short DwellLatency; 00259 unsigned short IgniteLatency; 00260 00261 /* Not an ISR, but important none the less */ 00262 unsigned short mathLatency; 00263 unsigned short mathSampleTimeStamp0; 00264 unsigned short mathSampleTimeStamp1; 00265 } ISRLatencyVar; 00266 00267 00268 #define CORE_VARS_SIZE sizeof(CoreVar) 00269 #define CORE_VARS_LENGTH 16 /* How many arrays */ 00270 #define CORE_VARS_UNIT 2 /* How large each element is in bytes (short = 2 bytes) */ 00271 /* Use this block to make it easy to manage the core variables */ 00272 typedef struct { 00273 /* Calculated and averaged from ADC0 readings */ 00274 unsigned short IAT; /* Inlet Air Temperature (MAT JS) : 0.0 - 655.35 (0.01 Kelvin (/100)) */ 00275 unsigned short CHT; /* Coolant / Head Temperature (CLT JS) : 0.0 - 655.35 (0.01 Kelvin (/100)) */ 00276 unsigned short TPS; /* Throttle Position Sensor (TPS JS) : 0.0 - 102.39 (0.001? % (/640)) */ 00277 unsigned short EGO; /* Exhaust Gas Oxygen (O2 JS) : 0.000 - 1.999999 (0.0001? lambda (/32768)) */ 00278 unsigned short MAP; /* Manifold Absolute Pressure (5euroh1) : 0.0 - 655.35 (0.01 kPa (/100)) */ 00279 unsigned short AAP; /* Atmospheric Absolute Pressure (6euroh1) : 0.0 - 655.35 (0.01 kPa (/100)) */ 00280 unsigned short BRV; /* Battery Reference Voltage (4euroh1) : 0.000 - 65.535 (0.001 Volts (/1000)) */ 00281 unsigned short MAT; /* Manifold Air Temperature (Spare JS) : 0.0 - 655.35 (0.01 Kelvin (/100)) */ 00282 00283 /* Calculated and averaged from ADC1 readings */ 00284 unsigned short EGO2; /* Exhaust Gas Oxygen (NC) : 0.000 - 1.999999 (0.0001? lambda (/32768)) */ 00285 unsigned short IAP; /* Intercooler Absolute Pressure (NC) : 0.0 - 655.35 (0.01 kPa (/100)) */ 00286 unsigned short MAF; /* Mass Air Flow : 0.0 - 65535.0 (raw units from lookup) */ 00287 00288 /* Calculated from MAP and TPS history */ 00289 unsigned short DMAP; /* Delta MAP kPa/second or similar */ 00290 unsigned short DTPS; /* Delta TPS %/second or similar */ 00291 00292 /* Calculated from engine position data */ 00293 unsigned short RPM; /* Revolutions Per Minute (Calced) : 0 - 32767.5 (0.5 RPM (/2)) */ 00294 unsigned short DRPM; /* Delta RPM (Calced) : 0 - 32767.5 (0.5 RPM/Second (/2)) */ 00295 unsigned short DDRPM; /* Delta Delta RPM (Calced) : 0 - 32767.5 (0.5 RPM/Second^2 (/2)) */ 00296 } CoreVar; 00297 00298 00299 #define ADC_ARRAY_SIZE sizeof(ADCArray) 00300 #define ADC_ARRAY_LENGTH 16 /* How many arrays */ 00301 #define ADC_ARRAY_UNIT 2 /* How large each element is in bytes (short = 2 bytes) */ 00302 /* Use this block to ensure that the components are contiguous and we can then reference them via offsets and pointers */ 00303 typedef struct { 00304 /* ADC0 raw readings */ 00305 unsigned short IAT; /* Inlet Air Temperature (MAT JS) */ /* COMPULSORY! */ 00306 unsigned short CHT; /* Coolant / Head Temperature (CLT JS) */ /* COMPULSORY! */ 00307 unsigned short TPS; /* Throttle Position Sensor (TPS JS) */ /* Reduced performance without */ 00308 unsigned short EGO; /* Exhaust Gas Oxygen (O2 JS) */ /* Recommended */ 00309 unsigned short BRV; /* Battery Reference Voltage (4euroh1) */ /* COMPULSORY! */ 00310 unsigned short MAP; /* Manifold Absolute Pressure (5euroh1) */ /* COMPULSORY OR TPS OR MAF */ 00311 unsigned short AAP; /* Atmospheric Absolute Pressure (6euroh1) */ /* Recommended */ 00312 unsigned short MAT; /* Manifold Air Temperature (Spare JS) */ /* Could help heat soak issues */ 00313 00314 /* ADC1 raw readings */ 00315 unsigned short EGO2; /* Exhaust Gas Oxygen (NC) */ /* V engine option */ 00316 unsigned short IAP; /* Intercooler Absolute Pressure (NC) */ /* Turbo engine option */ 00317 unsigned short MAF; /* Mass Air Flow (NC) */ /* OEM engine option */ 00318 unsigned short SpareADC3; /* Spare ADC1 port 3 (NC) */ 00319 unsigned short SpareADC4; /* Spare ADC1 port 4 (NC) */ 00320 unsigned short SpareADC5; /* Spare ADC1 port 5 (NC) */ 00321 unsigned short SpareADC6; /* Spare ADC1 port 6 (NC) */ 00322 unsigned short SpareADC7; /* Spare ADC1 port 7 (NC) */ 00323 } ADCArray; 00324 00325 00326 #define MAINTABLE_SIZE sizeof(mainTable) 00327 #define MAINTABLE_RPM_LENGTH 24 /* How many cells on the X axis */ 00328 #define MAINTABLE_LOAD_LENGTH 19 /* How many cells on the Y axis */ 00329 #define MAINTABLE_MAX_RPM_LENGTH 27 /* How many cells on the X axis max */ 00330 #define MAINTABLE_MAX_LOAD_LENGTH 21 /* How many cells on the Y axis max */ 00331 #define MAINTABLE_MAX_MAIN_LENGTH 462 /* 924B 462 shorts maximum main table length */ 00332 /* Main Table Structure definition */ 00333 /* Use this block to manage the main VE, Lambda and Timing tables. * 00334 * Tables can be made any size from 1x1 to 27x17 or 22x21 provided * 00335 * that the multiple of the two doesn't exceed the max main length * 00336 * and neither axis exceeds it's specified maximum. */ 00337 typedef struct { 00338 unsigned short RPMLength; /* The length of the RPM axis array */ 00339 unsigned short LoadLength; /* The length of the Load axis array */ 00340 unsigned short RPM[MAINTABLE_MAX_RPM_LENGTH]; /* The array of RPM (X) axis values */ 00341 unsigned short Load[MAINTABLE_MAX_LOAD_LENGTH]; /* The array of Load (Y) axis values */ 00342 unsigned short Table[MAINTABLE_MAX_MAIN_LENGTH]; /* The table as an array of values */ 00343 } mainTable; 00344 00345 00346 #define TWODTABLEUS_SIZE sizeof(twoDTableUS) 00347 #define TWODTABLEUS_LENGTH 16 00348 /* This block used for various curves */ 00349 typedef struct { 00350 unsigned short Axis[TWODTABLEUS_LENGTH]; 00351 unsigned short Values[TWODTABLEUS_LENGTH]; 00352 } twoDTableUS; 00353 00354 00355 #define TWODTABLESS_SIZE sizeof(twoDTableSS) 00356 #define TWODTABLESS_LENGTH 16 00357 /* This block used for various curves */ 00358 typedef struct { 00359 signed short Axis[TWODTABLESS_LENGTH]; 00360 signed short Values[TWODTABLESS_LENGTH]; 00361 } twoDTableSS; 00362 00363 00364 #define TWODTABLEMS_SIZE sizeof(twoDTableMS) 00365 #define TWODTABLEMS_LENGTH 16 00366 /* This block used for various curves */ 00367 typedef struct { 00368 unsigned short Axis[TWODTABLEMS_LENGTH]; 00369 signed short Values[TWODTABLEMS_LENGTH]; 00370 } twoDTableMS; 00371 00372 00373 #define TWODTABLEUC_SIZE sizeof(twoDTableUC) 00374 #define TWODTABLEUC_LENGTH 8 00375 /* This block used for various curves */ 00376 typedef struct { 00377 unsigned char Axis[TWODTABLEUC_LENGTH]; 00378 unsigned char Values[TWODTABLEUC_LENGTH]; 00379 } twoDTableUC; 00380 00381 00382 #define COUNTER_SIZE sizeof(Counter) 00383 #define COUNTER_LENGTH 21 /* How many counters */ 00384 #define COUNTER_UNIT 2 /* How large each element is in bytes (short = 2 bytes) */ 00385 /* Use this block to manage the execution count of various functions loops and ISRs etc */ 00386 typedef struct { 00387 /* Event Counters (all require init to zero) */ 00388 unsigned short callsToUISRs; /* Counter to ensure we aren't accidentally triggering unused ISRs */ 00389 unsigned short lowVoltageConditions; /* Counter for low voltage conditions */ 00390 00391 unsigned short crankSyncLosses; /* Counter for number of lost crank syncs */ 00392 unsigned short camSyncLosses; /* Counter for number of lost cam syncs */ 00393 unsigned short RPMValidityLosses; /* Counter for number of lost RPM validity events */ 00394 unsigned short primaryTeethDroppedFromLackOfSync; /* Counter for number of primary teeth dropped due to no primary sync */ 00395 // TODO remove the one above this line about teeth dropped???? probably... 00396 00397 unsigned short primaryTeethSeen; /* Free running counters for number of teeth seen such that... */ 00398 unsigned short secondaryTeethSeen; /* ...tooth timing can be used to reconstruct the signal at lower rpm */ 00399 00400 unsigned short syncedADCreadings; /* Incremented each time a syncronous ADC reading is taken */ 00401 unsigned short timeoutADCreadings; /* Incremented for each ADC reading in RTC because of timeout */ 00402 00403 unsigned short calculationsPerformed; /* Incremented for each time the fuel and ign calcs are done */ 00404 unsigned short datalogsSent; /* Incremented for each time we send out a log entry */ 00405 00406 /* UART/serial specific counters */ 00407 unsigned short serialStartsInsideAPacket; /* Incremented when a start byte is found inside a packet */ 00408 unsigned short serialEscapePairMismatches; /* Incremented when an escape is found but not followed by an escapee */ 00409 unsigned short serialPacketsOverLength; /* Incremented when the buffer fills up before the end */ 00410 unsigned short serialNoiseErrors; /* Incremented when noise is detected */ 00411 unsigned short serialOverrunErrors; /* Incremented when an overrun occurs */ 00412 unsigned short serialFramingErrors; /* Incremented when a framing error occurs */ 00413 unsigned short serialParityErrors; /* Incremented when a parity error occurs */ 00414 00415 /* Generic com counters */ 00416 unsigned short commsChecksumMismatches; /* Incremented when calculated checksum did not match the received one */ 00417 unsigned short commsDebugMessagesNotSent; /* Incremented when a debug message can't be sent due to the TX buffer */ 00418 unsigned short commsErrorMessagesNotSent; /* Incremented when an error message can't be sent due to the TX buffer */ 00419 } Counter; 00420 00421 00422 #define CLOCK_SIZE sizeof(Clock) 00423 #define CLOCK_LENGTH 9 /* How many clocks */ 00424 #define CLOCK_UNIT 2 /* How large each element is in bytes (short = 2 bytes) */ 00425 /* Use this block to manage the various clocks kept */ 00426 typedef struct { 00427 /* Real Time and other Clocks (all require init to zero) */ 00428 unsigned short realTimeClockMain; /* Variable to count RTI executions, 0.125ms exactly */ 00429 unsigned short realTimeClockMillis; /* Variable to count milliseconds exactly */ 00430 unsigned short realTimeClockTenths; /* Variable to count tenths of a second exactly */ 00431 unsigned short realTimeClockSeconds; /* Variable to count seconds exactly */ 00432 unsigned short realTimeClockMinutes; /* Variable to count minutes exactly */ 00433 00434 unsigned short millisToTenths; /* Rollover variable for counting tenths */ 00435 unsigned short tenthsToSeconds; /* Rollover variable for counting seconds */ 00436 unsigned short secondsToMinutes; /* Rollover variable for counting minutes */ 00437 00438 unsigned short timeoutADCreadingClock; /* Timeout clock/counter for synced ADC readings */ 00439 } Clock; 00440 00441 00442 #else 00443 /* let us know if we are being untidy with headers */ 00444 #warning "Header file STRUCTS_H seen before, sort it out!" 00445 /* end of the wrapper ifdef from the very top */ 00446 #endif