globalConstants.c File Reference

Global constant values. More...

#include "inc/freeEMS.h"
Include dependency graph for globalConstants.c:

Go to the source code of this file.

Defines

#define GLOBAL_CONSTANTS_C
#define NO_CONST_ARRAYS

Variables

const unsigned short maxBasicDatalogLength = sizeof(CoreVar) + sizeof(DerivedVar) + sizeof(ADCArray)
const unsigned char interfaceVersionAndType [20] = {0,0,0,'I','F','r','e','e','E','M','S',' ','V','a','n','i','l','l','a',0}
const unsigned char firmwareVersion [29] = {"FreeEMS Vanilla 0.1.1 XGATED"}
const unsigned long masterFuelConstant = 139371764
const unsigned long MAFFuelConstant = 0
const unsigned short injectorSwitchOnCodeTime = 100
const unsigned short injectorSwitchOffCodeTime = 100
const unsigned short injectorMaximumPulseWidth = 0xF424
const unsigned short injectorMinimumPulseWidth = 100
const unsigned short ignitionMaximumDwell = 50000
const unsigned short ignitionMinimumDwell = 500
const unsigned short ignitionMaximumDelayToDwellStartAfterTooth = 50000
const unsigned short ignitionMinimumDelayToDwellStartAfterTooth = 500
const unsigned short leadingEdgePrimaryRPMInputCodeTime = 100
const unsigned short trailingEdgePrimaryRPMInputCodeTime = 100
const unsigned short leadingEdgeSecondaryRPMInputCodeTime = 100
const unsigned short trailingEdgeSecondaryRPMInputCodeTime = 100
const unsigned short dwellStartMasks [IGNITION_CHANNELS] = { BIT8_16, BIT9_16, BIT10_16, BIT11_16, BIT12_16, BIT13_16, BIT14_16, BIT15_16, BIT0_16, BIT1_16, BIT2_16, BIT3_16}
const unsigned short ignitionMasks [IGNITION_CHANNELS] = {NBIT8_16,NBIT9_16,NBIT10_16,NBIT11_16,NBIT12_16,NBIT13_16,NBIT14_16,NBIT15_16,NBIT0_16,NBIT1_16,NBIT2_16,NBIT3_16}
const unsigned char injectorMainOnMasks [INJECTION_CHANNELS] = {BIT2, BIT3, BIT4, BIT5, BIT6, BIT7}
const unsigned char injectorMainOffMasks [INJECTION_CHANNELS] = {NBIT2, NBIT3, NBIT4, NBIT5, NBIT6, NBIT7}
const unsigned char injectorMainEnableMasks [INJECTION_CHANNELS] = {0x30, 0xC0, 0x03, 0x0C, 0x30, 0xC0}
const unsigned char injectorMainDisableMasks [INJECTION_CHANNELS] = {0xCF, 0x3F, 0xFC, 0xF3, 0xCF, 0x3F}
const unsigned char injectorMainGoHighMasks [INJECTION_CHANNELS] = {BIT4, BIT6, BIT0, BIT2, BIT4, BIT6}
const unsigned char injectorMainGoLowMasks [INJECTION_CHANNELS] = {NBIT4, NBIT6, NBIT0, NBIT2, NBIT4, NBIT6}

Detailed Description

Global constant values.

All global constants values are, and should be, defined here.

Author:
Fred Cooke

Definition in file globalConstants.c.


Define Documentation

#define GLOBAL_CONSTANTS_C

Definition at line 38 of file globalConstants.c.

#define NO_CONST_ARRAYS

Definition at line 39 of file globalConstants.c.


Variable Documentation

const unsigned short dwellStartMasks[IGNITION_CHANNELS] = { BIT8_16, BIT9_16, BIT10_16, BIT11_16, BIT12_16, BIT13_16, BIT14_16, BIT15_16, BIT0_16, BIT1_16, BIT2_16, BIT3_16}

Definition at line 165 of file globalConstants.c.

Referenced by IgnitionDwellISR().

const unsigned char firmwareVersion[29] = {"FreeEMS Vanilla 0.1.1 XGATED"}

Displayable firmware version identifier

This should change every time the code is changed at all (even a little) before each release.

Definition at line 77 of file globalConstants.c.

Referenced by decodePacketAndRespond().

const unsigned short ignitionMasks[IGNITION_CHANNELS] = {NBIT8_16,NBIT9_16,NBIT10_16,NBIT11_16,NBIT12_16,NBIT13_16,NBIT14_16,NBIT15_16,NBIT0_16,NBIT1_16,NBIT2_16,NBIT3_16}

Definition at line 166 of file globalConstants.c.

Referenced by IgnitionFireISR().

const unsigned short ignitionMaximumDelayToDwellStartAfterTooth = 50000

Definition at line 131 of file globalConstants.c.

const unsigned short ignitionMaximumDwell = 50000

Definition at line 125 of file globalConstants.c.

const unsigned short ignitionMinimumDelayToDwellStartAfterTooth = 500

Definition at line 134 of file globalConstants.c.

const unsigned short ignitionMinimumDwell = 500

Definition at line 128 of file globalConstants.c.

const unsigned char injectorMainDisableMasks[INJECTION_CHANNELS] = {0xCF, 0x3F, 0xFC, 0xF3, 0xCF, 0x3F}

Definition at line 172 of file globalConstants.c.

Referenced by InjectorXISR().

const unsigned char injectorMainEnableMasks[INJECTION_CHANNELS] = {0x30, 0xC0, 0x03, 0x0C, 0x30, 0xC0}

Definition at line 171 of file globalConstants.c.

Referenced by PrimaryRPMISR().

const unsigned char injectorMainGoHighMasks[INJECTION_CHANNELS] = {BIT4, BIT6, BIT0, BIT2, BIT4, BIT6}

Definition at line 173 of file globalConstants.c.

Referenced by InjectorXISR().

const unsigned char injectorMainGoLowMasks[INJECTION_CHANNELS] = {NBIT4, NBIT6, NBIT0, NBIT2, NBIT4, NBIT6}

Definition at line 174 of file globalConstants.c.

Referenced by InjectorXISR().

const unsigned char injectorMainOffMasks[INJECTION_CHANNELS] = {NBIT2, NBIT3, NBIT4, NBIT5, NBIT6, NBIT7}

Definition at line 170 of file globalConstants.c.

Referenced by InjectorXISR().

const unsigned char injectorMainOnMasks[INJECTION_CHANNELS] = {BIT2, BIT3, BIT4, BIT5, BIT6, BIT7}

Definition at line 169 of file globalConstants.c.

Referenced by InjectorXISR(), and PrimaryRPMISR().

const unsigned short injectorMaximumPulseWidth = 0xF424

Definition at line 117 of file globalConstants.c.

const unsigned short injectorMinimumPulseWidth = 100

Definition at line 120 of file globalConstants.c.

Referenced by PrimaryRPMISR().

const unsigned short injectorSwitchOffCodeTime = 100

Definition at line 114 of file globalConstants.c.

Referenced by PrimaryRPMISR().

const unsigned short injectorSwitchOnCodeTime = 100

Definition at line 111 of file globalConstants.c.

Referenced by InjectorXISR().

const unsigned char interfaceVersionAndType[20] = {0,0,0,'I','F','r','e','e','E','M','S',' ','V','a','n','i','l','l','a',0}

Serial interface unique identifier

This should only change when the serial interface changes (even a little)

This field consists of 3 chars for a 3 part version number and a free form string. For any unique string the version number is also unique. In this way tools can easily support a range of versions for a specific unique string ID

Definition at line 71 of file globalConstants.c.

Referenced by decodePacketAndRespond().

const unsigned short leadingEdgePrimaryRPMInputCodeTime = 100

Definition at line 139 of file globalConstants.c.

const unsigned short leadingEdgeSecondaryRPMInputCodeTime = 100

Definition at line 145 of file globalConstants.c.

const unsigned long MAFFuelConstant = 0

MAF fuel constant

Todo:
TODO Determine what the value of MAF fuel constant should be

Definition at line 107 of file globalConstants.c.

const unsigned long masterFuelConstant = 139371764

Divisors and untunable physical constants combined into a single master fuel constant

const unsigned short molarMassOfAir = 2897; // in grams per 100 moles, so divide by 100 to get gm/mol const unsigned short msToTicks = 1250; // constant to bring ms into 0.8us chunks const unsigned short universalGasConstant = 34056; // 8.314472 * 4096, so divide by 4096 to get real number

hash define injectorFlowDivisor 1024 hash define injectorFlowUnitDivisor 1000 - to get it into litres/second hash define injectorFlowTotalDivisor 1024000 hash define stoichiometricAFRDivisor 1024 hash define universalGasConstantDivisor 4096 hash define molarMassOfAirDivisor 100 hash define perCylinderVolumeDivisor 32768

TODO hash define the fuel constant for different clock tick setups (msToTicks will vary)

master = (msToTicks * molarMassOfAir * universalGasConstantDivisor * stoichiometricAFRDivisor * injectorFlowTotalDivisor) / (universalGasConstant * molarMassOfAirDivisor * perCylinderVolumeDivisor); master = (1250 * 2897 * 4096 * 1024 * 1024000 ) / (34056 * 100 * 32768 ); http://www.google.com/search?hl=en&safe=off&q=((1250+*+2897+*+4096+*+1024+*+1024000)+2F+(34056+*++100+*+32768)&btnG=Search

((1250 * 2897 * 4096 * 1024 * 1024000) / (34056 * 100 * 32768) = 139371764

Definition at line 101 of file globalConstants.c.

Referenced by initConfiguration().

const unsigned short maxBasicDatalogLength = sizeof(CoreVar) + sizeof(DerivedVar) + sizeof(ADCArray)

Definition at line 57 of file globalConstants.c.

Referenced by decodePacketAndRespond(), and initVariables().

const unsigned short trailingEdgePrimaryRPMInputCodeTime = 100

Definition at line 142 of file globalConstants.c.

const unsigned short trailingEdgeSecondaryRPMInputCodeTime = 100

Definition at line 148 of file globalConstants.c.

Referenced by PrimaryRPMISR().

Generated on Sat Oct 16 21:29:11 2010 for FreeEMS by  doxygen 1.6.3