Configuration = 'efahl v.1.00' RAM = { #PUBLIC ;******************************************************************************* ;* MegaSquirt RAM Variables ;******************************************************************************* ; ; RAM Variables - Ordered List for RS232 realtime download - ; delivered in one packet. ; ;=============================================================================== ; First 19 must have their order maintained for compatibility with ; original Configurator. Currently broken by pw2. secl byte ; low seconds - from 0 to 255, then rollover squirt byte ; Event variable bit field for Injector Firing engine byte ; Variable bit-field to hold engine current status barometer byte = 101T ; ADC Raw Barometer Reading - count (0 - 255) ;------------------------------------------------------------------------------- ; Raw ADC Counts ; This block must remain in exactly this order as it is dictated by the ; hardware configuration. See DoADC and schematic. map byte = 70T ; Manifold Absolute Pressure mat byte = $BB ; Manifold Air Temperature clt byte = $BB ; Coolant Temperature TPS byte = $BB ; Throttle Position Sensor batt byte = $BB ; Battery Voltage EGO byte = $BB ; Exhaust Gas Oxygen ;------------------------------------------------------------------------------- EGOcorr byte = 100T ; Oxygen Sensor Correction AirCorr byte = 100T ; Air Density Correction lookup - percent warmcor byte = 100T ; Total Warmup Correction - percent rpm byte ; Computed engine RPM - rpm/100 pw1 byte ; injector squirt time in 1/10 millisec (0 to 25.5 millisec) - applied pw2 byte ; the other pw comparison (injector #2) TPSaccel byte ; Acceleration enrichment - percent barocor byte = 100T ; Barometer Lookup Correction - percent GammaE byte = 100T ; Total Gamma Enrichments - percent vecurr byte = 100T ; Current VE value from lookup table - percent #PRIVATE ;------------------------------------------------------------------------------- ; Pulse width stuff. pwcalc1 byte ; Computed injector 1 pulse width - move into variable PW1 at pulse time pwcalc2 byte ; Computed injector 2 pulse width pwrun1 byte ; Pulsewidth timing variable - from 0 to 25.4ms pwrun2 byte ;------------------------------------------------------------------------------- ; Actual engine parameters in engineering units. kpa byte ; MAP value in kPa coolant byte ; Coolant temperature in Degrees F plus 40 (allows -40 degress to fit in ubyte) throttle byte ; Throttle position in percent ;------------------------------------------------------------------------------- ; Engine RPM -> RPM = 12000/(ncyl * (rpmph - rpmpl)) rpmph byte ; High part of RPM Period rpmpl byte ; Low part of RPM Period rpmch byte ; Counter for high part of RPM rpmcl byte ; Counter for low part of RPM ;---------------------------------------------------------------------------- ; Previous raw ADC values for computing derivatives. Must correspond ; exactly to the block above starting with "map". lmap byte ; Manifold Absolute Pressure ADC last Reading lmat byte ; Manifold Air Temp ADC last Reading lclt byte ; Coolant Temperature ADC last Reading lTPS byte ; Throttle Position Sensor ADC last Reading lbatt byte ; Battery Voltage ADC last Reading lEGO byte ; Last EGO ADC reading ;---------------------------------------------------------------------------- ; Global Time Clock mms byte ; 0.0001 second update variable ms byte ; 0.001 second increment tenth byte ; 1/10th second sech byte ; high seconds - rollover at 65536 secs (1110.933 minutes, 18.51 hours) TPSaclk byte ; TPS enrichment timer clock in 0.1 second resolution EGOcount byte ; Counter value for EGO step - incremented every ignition pulse asecount byte ; Counter value for after-start enrichment counter - every ignition pulse igncount byte ; Ignition pulse counter altcount byte ; Alternate count selector TPSaclkcmp byte ; Comparison value for TPS acceleration time - from lookup table TPSfuelcut byte = 100T ; TPS Fuel Cut (percent) ;---------------------------------------------------------------------------- ; SCI parameters/variables txcnt byte ; SCI transmitter count (incremented) txgoal byte ; SCI number of bytes to transmit txmode byte ; Transmit mode flag rxoffset byte ; offset placeholder when receiving VE/constants vis. SCI adsel byte ; ADC Selector Variable last_TPS byte = $FF ; TPS reading updated every 0.1 seconds ;---------------------------------------------------------------------------- ; Routines for integer math - storage variables INTACC1 byte(4) INTACC2 byte(4) SPVAL byte(4) ;---------------------------------------------------------------------------- ; Extra "registers" tmp1 byte tmp2 byte tmp3 byte tmp4 byte tmp5 byte tmp6 byte tmp7 byte tmp8 byte tmp9 byte tmp10 byte tmp11 byte tmp12 byte tmp13 byte tmp14 byte tmp15 byte tmp16 byte tmp17 byte tmp18 byte tmp19 byte } RAM_FLASH = { ;------------------------------------------------------------------------------- ; Flash Configuration Variables here - variables can be downloaded by pcc or clc. ;------------------------------------------------------------------------------- ; VETABLE and Constants ; ; VE table RPM Bins for 2-D interpolation RPMRANGEVE byte(8) = { 5T, 10T, 15T, 20T, 28T, 36T, 44T, 52T } ; VE Table MAP Pressure Bins for 2_D interp. KPARANGEVE byte(8) = { 20T, 30T, 40T, 50T, 60T, 75T, 90T, 100T } VE byte(64) = { ; 64 bytes for VE Table 18T, 18T, 18T, 18T, 18T, 18T, 18T, 18T, ; VE (0,n) 22T, 25T, 30T, 32T, 35T, 35T, 35T, 35T, ; VE (1,n) 35T, 35T, 35T, 35T, 35T, 35T, 35T, 35T, ; VE (2,n) 50T, 50T, 50T, 50T, 50T, 50T, 50T, 50T, ; VE (3,n) 50T, 50T, 50T, 50T, 50T, 50T, 50T, 50T, ; VE (4,n) 50T, 50T, 50T, 50T, 50T, 50T, 50T, 50T, ; VE (5,n) 65T, 65T, 65T, 65T, 65T, 65T, 65T, 65T, ; VE (6,n) 80T, 80T, 80T, 80T, 80T, 80T, 80T, 90T ; VE (7,n) } ;------------------------------------------------------------------------------- FASTIDLE byte = 185T ; Fast Idle Temperature CWU byte = 100T ; Crank Enrichment at -40 F CWH byte = 025T ; Crank Enrichment at 170 F AWEV byte = 020T ; After-start Warmup Percent enrichment add-on value AWC byte = 250T ; After-start number of cycles TPSAQ byte(4) = { ; TPS acceleration amount (fn TPSDOT) in 0.1 ms units 13T, ; TPSdot = 0.1 v/ms 30T, ; TPSdot = 0.4 40T, ; TPSdot = 0.8 40T ; TPSdot = 1.5 } TPSacold byte = 2T ; Cold acceleration amount (at -40 degrees) in 0.1 ms units TPSthresh byte = 6T ; Accel TPS DOT threshold TPSASYNC byte = 10T ; ***** TPS Acceleration clock value TPSDQ byte = 20T ; Deacceleration fuel cut EGOtemp byte = 200T ; Coolant Temperature where EGO is active EGOcountcmp byte = 32T ; Counter value where EGO step is to occur EGOdelta byte = 1T ; EGO Percent step size for rich/lean EGOlimit byte = 10T ; Upper/Lower EGO rail limit (egocorr is inside 100 +/- Limit) REQ_FUEL byte = 155T ; Fuel constant DIVIDER byte = 4T ; IRQ divide factor for pulse Alternate byte = 1T ; Alternating injector squirts InjOpen byte = 10T ; Injector Open Time InjOCFuel byte = 0T ; PW-correlated amount of fuel injected during injector open INJPWM1 byte = 30T ; Bank 1 - Injector PWM duty cycle at current limit INJPWMT1 byte = 255T ; Bank 1 - Injector PWM mmillisec time at which to activate. INJPWM2 byte = 30T ; Bank 2 - Injector PWM duty cycle at current limit INJPWMT2 byte = 255T ; Bank 2 - Injector PWM mmillisec time at which to activate. BATTFAC byte = 12T ; Battery Gamma Factor WWU byte(10) = { ; Warmup bins(fn temp) 120T, ; -40 F 120T, ; -20 F 115T, ; 0 F 115T, ; 20 F 115T, ; 40 F 110T, ; 60 F 105T, ; 80 F 100T, ; 100 F 100T, ; 130 F 100T ; 160 F } ;------------------------------------------------------------------------------- ; Constant for RPM = 12,000/ncyl - downloaded constant rpmk byte(2) = { $05, $DC } revLimit byte = 070T ; Rev limit TPSlow byte = 050T ; ADC count for TPS value corresponding to 0% throttle position TPSrange byte = 200T ; ADC count corresponding to 100% throttle minus TPSlow ; Nitrous switch parameters. minN2Otemp byte = 160T ; Coolant temperature below which N2O is disabled. lowN2ORPM byte = 35T ; RPM below which N2O is disabled. highN2ORPM byte = 67T ; RPM above which N2O is disabled. ;------------------------------------------------------------------------------- ; CONFIG11 Bit Definitions (this is used for PC Configurator Only - not used ; in embedded code) ; ; Bit 0-1 = MAP Type ; 00 = MPX4115AP ; 01 = MPX4250AP ; 10 = User-defined ; 11 = User-Defined ; Bit 2 = Engine Stroke ; 0 = Four Stroke ; 1 = Two Stroke ; Bit 3-4 = Not Used ; Bit 5-7 = Number of Cylinders - 1 ; 000 = 1 cylinder ; 001 = 2 cylinders ; 010 = 3 cylinders ; 011 = 4 cylinders ; 100 = 5 cylinder ; 101 = 6 cylinders ; 110 = 7 cylinders ; 111 = 8 cylinders Config11 byte = %00000011 ; Configuration for PC Configurator - placeholder only } HIGH_RAM = { ; RAM above $200 bcDC byte = 50T } FLASH = { ; This is used to set the bin coolant range for WWU WWUrange byte(10) = { 0T, 20T, 40T, 60T, 80T, 100T, 120T, 140T, 170T, 200T } TPSdotrate byte(4) = { 5T, ; 0.1 volts delta 20T, ; 0.4 volt 40T, ; 0.8 volt 77T ; 1.5 volt } }