structs.h

Go to the documentation of this file.
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 
00066 } tribyte;
00067 
00068 
00069 typedef struct {
00070         unsigned char RAMPage;
00071         unsigned char FlashPage;
00072         void* RAMAddress;
00073         void* FlashAddress;
00074         unsigned short size;
00075 } blockDetails;
00076 
00077 // memory block addresses description parameters
00078 
00079 
00080 /* Fixed Configuration - place things that do not    *
00081  * change after initial setup or during tuning here. */
00082 #define FIXED_CONFIG_SIZE sizeof(fixedConfig)
00083 typedef struct {
00084 
00085         /* Settings variables : 0 = false */
00086         unsigned short coreSettingsA;   /* Each bit represents the state of some core setting, masks below and above where the same one is used */
00087         /* Bit masks for coreSettingsA */ // TODO needs a rename, as does coreStatusA
00088         //#define COREA1                        BIT1_16         /*  1 */
00089         #define PRIMARY_POLARITY        BIT2_16         /*  2 1 = high teeth 0 = low teeth */
00090         #define SECONDARY_POLARITY      BIT3_16         /*  3 1 = high teeth 0 = low teeth */
00091         //#define COREA4                        BIT4_16         /*  4 */
00092         //#define FUEL_CUT                      BIT5_16         /*  5 Remove injection completely */
00093         //#define HARD_SPARK_CUT        BIT6_16         /*  6 Remove ignition completely */
00094         //#define SOFT_SPARK_CUT        BIT7_16         /*  7 Remove ignition events round robin style */
00095         //#define SPARK_RETARD          BIT8_16         /*  8 Retard ignition in RPM dependent way */
00096         #define STAGED_ON                       BIT9_16         /*  9 Whether we are firing the staged injectors */
00097         #define STAGED_START            BIT10_16        /* 10 1 = Fixed start 0 = Scheduled start */
00098         #define STAGED_END                      BIT11_16        /* 11 1 = Fixed end 0 = Scheduled end */
00099         //#define COREA12                       BIT12_16        /* 12 */
00100         //#define COREA13                       BIT13_16        /* 13 */
00101         //#define COREA14                       BIT14_16        /* 14 */
00102         //#define COREA15                       BIT15_16        /* 15 */
00103         //#define COREA16                       BIT16_16        /* 16 */
00104 
00105 
00106         /* Pre configured value settings for the sensor inputs */
00107         unsigned short presetIAT;
00108         unsigned short presetCHT;
00109         unsigned short presetTPS;
00110         unsigned short presetEGO;
00111         unsigned short presetBRV;
00112         unsigned short presetMAP;
00113         unsigned short presetAAP;
00114         unsigned short presetMAT;
00115         unsigned short presetEGO2;
00116         unsigned short presetIAP;
00117         unsigned short presetBPW; /* Base Pulse Width */
00118         unsigned short presetAF; /* Air Flow */
00119 
00120 
00121         /* Fuel injection settings TODO duplication from original temp code below!! */
00122         unsigned short perCylinderVolume;       /* 500cc = 0.5l 0.5 * 32768 = pcv, so divide by 32768 go get litres */
00123         unsigned short stoichiometricAFR;       /* 34 for hydrogen, all others less, figure is 14.7 * 1024, divide by 1024 to get AFR */
00124         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 */
00125         unsigned short densityOfFuelAtSTP; /* 703gm/litre for Octane. 32 * fuel density = number, divide by 32 for the real figure */
00126 
00127         /* Sensor related settings */
00128         unsigned short TPSClosedMAP;
00129         unsigned short TPSOpenMAP;
00130 
00131 
00132         /* Sensor input conditioning settings */
00133         /* These are used to calculate MAP, EGO and TPS from ADC readings. */
00134         unsigned short MAPMinimum;                                                      /* 0 kPa usually. */
00135         unsigned short MAPRange;                                                        /* 10000, 11500, 25000, 30000, 40000 etc (/100 for kPa) */
00136         unsigned short AAPMinimum;                                                      /* 0 kPa usually. */
00137         unsigned short AAPRange;                                                        /* 10000, 11500, 25000, 30000, 40000 etc (/100 for kPa) */
00138         unsigned short EGOMinimum;                                                      /* 0.5 lambda ? (0.5 x 32768 = 16384) */
00139         unsigned short EGORange;                                                        /* 1.5 lambda ? ((1.5 - 0.5) x 32768 = 32768 (max 49152)) */
00140         unsigned short BRVMinimum;                                                      /* 0 Volts usually. */
00141         unsigned short BRVRange;                                                        /* 24.5 Volts for 10k and 39k resistors on a 12v vehicle */
00142         unsigned short TPSMinimumADC;                                           /* *should* be zero, but often isn't, this value corresponds to 0% TPS */
00143         unsigned short TPSMaximumADC;                                           /*  */
00144         // unsigned short TPSADCRange;                                          // ?? 100% = how many ADCs ?
00145         /*efine TPS_MINIMUM 0                                                           ** = 0.00%              For clarity ONLY, always zero.  */
00146         #define TPS_RANGE_MAX 64000                                                     /* = 100.00%                                                                    */
00147 
00148         /* Setting variables (must be inited with useful values) */
00149         unsigned short capacityOfAirPerCombustionEvent;         /* How much air it swallows per power producing event   */
00150         unsigned short perPrimaryInjectorChannelFlowRate;       /* How much fuel flows per minute per channel                   */
00151         unsigned short perSecondaryInjectorChannelFlowRate;     /* How much fuel flows per minute per channel                   */
00152         unsigned short readingTimeout;                                          /* How often an ADC reading MUST occur                                  */
00153         unsigned char ports;                                                            /* How many groups of injectors we are firing                   */
00154         unsigned char coils;                                                            /* How many coils we are firing                                                 */
00155         unsigned char combustionEventsPerEngineCycle;           /* How many power producing events per engine cycle             */
00156         unsigned char revolutionsPerEngineCycle;                        /* Rotary = 1, 2 Stroke = 1, 4 Stroke = 2                               */
00157         unsigned char primaryTeeth;                                                     /* How many teeth are on the crank signal including the missing ones if any (eg. 36-1 primary = 36 not 35) */
00158         unsigned char missingTeeth;                                                     /* Number sequentially removed from primary teeth (eg. 36-1 missing = 1) */
00159 
00160         /* Serial settings */
00161         unsigned short baudDivisor;                                                     /* 22 = (40MHz / (16*115.2kHz)) = 21.7013889 */
00162         unsigned char networkAddress;                                           /* Default = 1, Default for PC = 10 */
00163 
00164         /* Tacho settings */
00165         unsigned char tachoTickFactor;
00166         unsigned short tachoTotalFactor;
00167 
00168         /* User text field for noting which installation the unit is from etc. */
00169         unsigned char userTextField[userTextFieldArrayLength]; /* "Place your personal notes here!!" */
00170 } fixedConfig;
00171 
00172 
00173 #define DERIVED_VARS_SIZE sizeof(DerivedVar)
00174 #define DERIVED_VARS_WIDTH IN_OUT_BANKS /* How many elements per array currently 2 at 25/6/08 */
00175 #define DERIVED_VARS_UNIT 2                             /* How large each element is in bytes (short = 2 bytes) */
00176 /* Use this block to make it easy to manage the derived variables */
00177 typedef struct {
00178         /* Calculated from core vars */
00179         unsigned short LoadMain[IN_OUT_BANKS];                  /* Configurable unit of load */
00180 //      unsigned short LoadSecondary[IN_OUT_BANKS];
00181 
00182         unsigned short VEMain[IN_OUT_BANKS];                    /* Divide by 512 to get % */
00183 //      unsigned short VESecondary[IN_OUT_BANKS];
00184 
00185         unsigned short Lambda[IN_OUT_BANKS];                    /* Divide by 32768 to get Lamda */
00186         unsigned short AirFlow[IN_OUT_BANKS];                   /* top half */
00187         unsigned short densityAndFuel[IN_OUT_BANKS];    /* bottom half */
00188 
00189         unsigned short BasePW[IN_OUT_BANKS];                    /* In timer ticks of 0.8us */
00190         unsigned short IDT[IN_OUT_BANKS];                               /* 0.8us ticks */
00191         unsigned short ETE[IN_OUT_BANKS];                               /* 0.8us ticks */
00192         signed short TFCTotal[IN_OUT_BANKS];                    /* Transient fuel correction */
00193 
00194         unsigned short FinalPW[IN_OUT_BANKS];                   /* In timer ticks of 0.8us */
00195         unsigned short RefPW[IN_OUT_BANKS];                     /* In timer ticks of 0.8us */
00196 
00197 //      unsigned short [IN_OUT_BANKS];          /*  */
00198 } DerivedVar;
00199 
00200 
00201 #define RUNTIME_VARS_SIZE sizeof(RuntimeVar)
00202 #define RUNTIME_VARS_LENGTH 13          /* How many runtime vars */
00203 #define RUNTIME_VARS_UNIT 2                             /* How large each element is in bytes (short = 2 bytes) */
00204 /* Use this block to manage the execution time of various functions loops and ISRs etc */
00205 typedef struct {
00206         /* Engine position and RPM code runtimes */
00207         unsigned short primaryInputLeadingRuntime;
00208         unsigned short primaryInputTrailingRuntime;
00209         unsigned short secondaryInputLeadingRuntime;
00210         unsigned short secondaryInputTrailingRuntime;
00211 
00212         /* Mathematics runtimes */
00213         unsigned short calcsRuntime;
00214         unsigned short genCoreVarsRuntime;
00215         unsigned short genDerivedVarsRuntime;
00216         unsigned short mathTotalRuntime;
00217         unsigned short mathSumRuntime;
00218 
00219         unsigned short RTCRuntime;
00220 
00221         /*  */
00222         unsigned short mainLoopRuntime;
00223         unsigned short logSendingRuntime;
00224         unsigned short serialISRRuntime;
00225 } RuntimeVar;
00226 
00227 
00228 #define ISR_LATENCY_VARS_SIZE sizeof(ISRLatencyVar)
00229 #define ISR_LATENCY_VARS_LENGTH 2               /* How many latency vars */
00230 #define ISR_LATENCY_VARS_UNIT 2                         /* How large each element is in bytes (short = 2 bytes) */
00231 /* Use this block to manage the execution time of various functions loops and ISRs etc */
00232 typedef struct {
00233         /* Engine position and RPM code latencies */
00234         unsigned short primaryInputLatency;
00235         unsigned short secondaryInputLatency;
00236 
00237         /* Injector latencies */
00238         unsigned short Injector1Latency;
00239         unsigned short Injector2Latency;
00240         unsigned short Injector3Latency;
00241         unsigned short Injector4Latency;
00242         unsigned short Injector5Latency;
00243         unsigned short Injector6Latency;
00244 
00245         unsigned short DwellLatency;
00246         unsigned short IgniteLatency;
00247 
00248         /* Not an ISR, but important none the less */
00249         unsigned short mathLatency;
00250         unsigned short mathSampleTimeStamp[IN_OUT_BANKS];
00251 } ISRLatencyVar;
00252 
00253 
00254 #define CORE_VARS_SIZE sizeof(CoreVar)
00255 #define CORE_VARS_LENGTH 16                             /* How many arrays */
00256 #define CORE_VARS_UNIT 2                                /* How large each element is in bytes (short = 2 bytes) */
00257 /* Use this block to make it easy to manage the core variables */
00258 typedef struct {
00259         /* Calculated and averaged from ADC0 readings */
00260         unsigned short IAT[IN_OUT_BANKS];                       /* Inlet Air Temperature (MAT JS)                       : 0.0   -    655.35             (0.01 Kelvin (/100))            */
00261         unsigned short CHT[IN_OUT_BANKS];                       /* Coolant / Head Temperature (CLT JS)          : 0.0   -    655.35             (0.01 Kelvin (/100))            */
00262         unsigned short TPS[IN_OUT_BANKS];                       /* Throttle Position Sensor (TPS JS)            : 0.0   -    102.39             (0.001? % (/640))                       */
00263         unsigned short EGO[IN_OUT_BANKS];                       /* Exhaust Gas Oxygen (O2 JS)                           : 0.000 -      1.999999 (0.0001? lambda (/32768))       */
00264         unsigned short MAP[IN_OUT_BANKS];                       /* Manifold Absolute Pressure (5euroh1)         : 0.0   -    655.35             (0.01 kPa (/100))                       */
00265         unsigned short AAP[IN_OUT_BANKS];                       /* Atmospheric Absolute Pressure (6euroh1)      : 0.0   -    655.35             (0.01 kPa (/100))                       */
00266         unsigned short BRV[IN_OUT_BANKS];                       /* Battery Reference Voltage (4euroh1)          : 0.000 -     65.535    (0.001 Volts (/1000))           */
00267         unsigned short MAT[IN_OUT_BANKS];                       /* Manifold Air Temperature (Spare JS)          : 0.0   -    655.35             (0.01 Kelvin (/100))            */
00268 
00269         /* Calculated and averaged from ADC1 readings */
00270         unsigned short EGO2[IN_OUT_BANKS];                      /* Exhaust Gas Oxygen (NC)                                      : 0.000 -      1.999999 (0.0001? lambda (/32768))       */
00271         unsigned short IAP[IN_OUT_BANKS];                       /* Intercooler Absolute Pressure (NC)           : 0.0   -    655.35             (0.01 kPa (/100))                       */
00272         unsigned short MAF[IN_OUT_BANKS];                       /* Mass Air Flow                                                        : 0.0   -  65535.0              (raw units from lookup)         */
00273 
00274         /* Calculated from MAP and TPS history */
00275         unsigned short DMAP[IN_OUT_BANKS];                      /* Delta MAP kPa/second or similar */
00276         unsigned short DTPS[IN_OUT_BANKS];                      /* Delta TPS %/second or similar */
00277 
00278         /* Calculated from engine position data */
00279         unsigned short RPM[IN_OUT_BANKS];                       /* Revolutions Per Minute (Calced)                      : 0             -  32767.5              (0.5 RPM (/2))                          */
00280         unsigned short DRPM[IN_OUT_BANKS];                      /* Delta RPM (Calced)                                           : 0             -  32767.5              (0.5 RPM/Second (/2))           */
00281         unsigned short DDRPM[IN_OUT_BANKS];                     /* Delta Delta RPM (Calced)                                     : 0             -  32767.5              (0.5 RPM/Second^2 (/2))         */
00282 } CoreVar;
00283 
00284 
00285 #define ADC_ARRAY_SIZE sizeof(ADCArray)
00286 #define ADC_ARRAY_LENGTH 16                             /* How many arrays */
00287 #define ADC_ARRAY_UNIT 2                                /* How large each element is in bytes (short = 2 bytes) */
00288 /* Use this block to ensure that the components are contiguous and we can then reference them via offsets and pointers */
00289 typedef struct {
00290         /* ADC0 raw readings */
00291         unsigned short IAT[IN_OUT_BANKS];                       /* Inlet Air Temperature (MAT JS)                       */ /* COMPULSORY! */
00292         unsigned short CHT[IN_OUT_BANKS];                       /* Coolant / Head Temperature (CLT JS)          */ /* COMPULSORY! */
00293         unsigned short TPS[IN_OUT_BANKS];                       /* Throttle Position Sensor (TPS JS)            */ /* Reduced performance without */
00294         unsigned short EGO[IN_OUT_BANKS];                       /* Exhaust Gas Oxygen (O2 JS)                           */ /* Recommended */
00295         unsigned short BRV[IN_OUT_BANKS];                       /* Battery Reference Voltage (4euroh1)          */ /* COMPULSORY! */
00296         unsigned short MAP[IN_OUT_BANKS];                       /* Manifold Absolute Pressure (5euroh1)         */ /* COMPULSORY OR TPS OR MAF */
00297         unsigned short AAP[IN_OUT_BANKS];                       /* Atmospheric Absolute Pressure (6euroh1)      */ /* Recommended */
00298         unsigned short MAT[IN_OUT_BANKS];                       /* Manifold Air Temperature (Spare JS)          */ /* Could help heat soak issues */
00299 
00300         /* ADC1 raw readings */
00301         unsigned short EGO2[IN_OUT_BANKS];                      /* Exhaust Gas Oxygen (NC)                                      */ /* V engine option */
00302         unsigned short IAP[IN_OUT_BANKS];                       /* Intercooler Absolute Pressure (NC)           */ /* Turbo engine option */
00303         unsigned short MAF[IN_OUT_BANKS];                       /* Mass Air Flow (NC)                                           */ /* OEM engine option */
00304         unsigned short SpareADC3[IN_OUT_BANKS];         /* Spare ADC1 port 3 (NC)                                       */
00305         unsigned short SpareADC4[IN_OUT_BANKS];         /* Spare ADC1 port 4 (NC)                                       */
00306         unsigned short SpareADC5[IN_OUT_BANKS];         /* Spare ADC1 port 5 (NC)                                       */
00307         unsigned short SpareADC6[IN_OUT_BANKS];         /* Spare ADC1 port 6 (NC)                                       */
00308         unsigned short SpareADC7[IN_OUT_BANKS];         /* Spare ADC1 port 7 (NC)                                       */
00309 } ADCArray;
00310 
00311 
00312 #define MAINTABLE_SIZE sizeof(mainTable)
00313 #define MAINTABLE_RPM_LENGTH 24                 /* How many cells on the X axis */
00314 #define MAINTABLE_LOAD_LENGTH 19                /* How many cells on the Y axis */
00315 #define MAINTABLE_MAX_RPM_LENGTH 27             /* How many cells on the X axis max */
00316 #define MAINTABLE_MAX_LOAD_LENGTH 21    /* How many cells on the Y axis max */
00317 #define MAINTABLE_MAX_MAIN_LENGTH 462   /* 924B 462 shorts maximum main table length */
00318 /* Main Table Structure definition */
00319 /* Use this block to manage the main VE, Lambda and Timing tables. *
00320  * Tables can be made any size from 1x1 to 27x17 or 21x22 provided *
00321  * that the multiple of the two doesn't exceed the max main length *
00322  * and neither axis exceeds it's specified maximum.                */
00323 typedef struct {
00324         unsigned short RPMLength;                                               /* The length of the RPM axis table */
00325         unsigned short LoadLength;                                              /* The length of the Load axis table */
00326         unsigned short RPM[MAINTABLE_MAX_RPM_LENGTH];           /* The table of RPM (X) axis values */
00327         unsigned short Load[MAINTABLE_MAX_LOAD_LENGTH];         /* The table of Load (Y) axis values */
00328         unsigned short Table[MAINTABLE_MAX_MAIN_LENGTH];        /* The actual table of values */
00329 } mainTable;
00330 
00331 
00332 #define TWODTABLEUS_SIZE sizeof(twoDTableUS)
00333 #define TWODTABLEUS_LENGTH 16
00334 /* This block used for various curves */
00335 typedef struct {
00336         unsigned short Axis[TWODTABLEUS_LENGTH];
00337         unsigned short Values[TWODTABLEUS_LENGTH];
00338 } twoDTableUS;
00339 
00340 
00341 #define COUNTER_SIZE sizeof(Counter)
00342 #define COUNTER_LENGTH 21                       /* How many counters */
00343 #define COUNTER_UNIT 2                          /* How large each element is in bytes (short = 2 bytes) */
00344 /* Use this block to manage the execution count of various functions loops and ISRs etc */
00345 typedef struct {
00346         /* Event Counters (all require init to zero) */
00347         unsigned short UISRCounter;                                                     /* Counter to ensure we aren't accidentally triggering unused ISRs              */
00348         unsigned short lowVoltISRCounter;                                       /* Counter for low voltage conditions                                                                   */
00349 
00350         unsigned short lostCrankSyncCounter;                            /* Counter for number of lost crank syncs                                                               */
00351         unsigned short lostCamSyncCounter;                                      /* Counter for number of lost cam syncs                                                                 */
00352         unsigned short lostRPMValidityCounter;                          /* Counter for number of lost RPM validity events                                               */
00353         unsigned short primaryTeethDroppedFromLackOfSync;       /* Counter for number of primary teeth dropped due to no primary sync   */
00354 
00355         unsigned short primaryTeethCounter;                                     /* Free running counters for number of teeth seen such that...                  */
00356         unsigned short secondaryTeethCounter;                           /* ...tooth timing can be used to reconstruct the signal at lower rpm   */
00357 
00358         unsigned short syncedADCreadingCounter;                         /* Incremented each time a syncronous ADC reading is taken                              */
00359         unsigned short timeoutADCreadingCounter;                        /* Incremented for each ADC reading in RTC because of timeout                   */
00360 
00361         unsigned short calcsPerformedCounter;                           /* Incremented for each time the fuel and ign calcs are done                    */
00362         unsigned short logsSentCounter;                                         /* Incremented for each time we send out a log entry                                    */
00363 
00364         unsigned short serialPacketOverLengthCounter;           /* Incremented when the buffer fills up before the end                                  */
00365         unsigned short serialStartInsidePacketCounter;          /* Incremented when a start byte is found inside a packet                               */
00366         unsigned short serialEscapePairMismatchCounter;         /* Incremented when an escape is found but not followed by an escapee   */
00367         unsigned short serialChecksumMismatchCounter;           /* Incremented when calculated checksum did not match the received one  */
00368         unsigned short serialNoiseErrorCounter;                         /* Incremented when noise is detected                                                                   */
00369         unsigned short serialOverrunErrorCounter;                       /* Incremented when an overrun occurs                                                                   */
00370         unsigned short serialFramingErrorCounter;                       /* Incremented when a framing error occurs                                                              */
00371         unsigned short serialParityErrorCounter;                        /* Incremented when a parity error occurs                                                               */
00372         unsigned short serialDebugUnsentCounter;                        /* Incremented when a parity error occurs                                                               */
00373 } Counter;
00374 
00375 
00376 #define CLOCK_SIZE sizeof(Clock)
00377 #define CLOCK_LENGTH 9                          /* How many clocks */
00378 #define CLOCK_UNIT 2                            /* How large each element is in bytes (short = 2 bytes) */
00379 /* Use this block to manage the various clocks kept */
00380 typedef struct {
00381         /* Real Time and other Clocks (all require init to zero) */
00382         unsigned short realTimeClockMain;                                       /* Variable to count RTI executions, 0.125ms exactly    */
00383         unsigned short realTimeClockMillis;                                     /* Variable to count milliseconds exactly                               */
00384         unsigned short realTimeClockTenths;                                     /* Variable to count tenths of a second exactly                 */
00385         unsigned short realTimeClockSeconds;                            /* Variable to count seconds exactly                                    */
00386         unsigned short realTimeClockMinutes;                            /* Variable to count minutes exactly                                    */
00387 
00388         unsigned short millisToTenths;                                          /* Rollover variable for counting tenths                                */
00389         unsigned short tenthsToSeconds;                                         /* Rollover variable for counting seconds                               */
00390         unsigned short secondsToMinutes;                                        /* Rollover variable for counting minutes                               */
00391 
00392         unsigned short timeoutADCreadingClock;                          /* Timeout clock/counter for synced ADC readings                */
00393 } Clock;
00394 
00395 
00396 #else
00397         /* let us know if we are being untidy with headers */
00398         #warning "Header file STRUCTS_H seen before, sort it out!"
00399 /* end of the wrapper ifdef from the very top */
00400 #endif

Generated on Mon Nov 10 21:18:50 2008 for freeems by  doxygen 1.5.2