Page 1 of 1

58x ECU

Posted: Thu Jun 19, 2025 10:16 pm
by AngelMarc
By modifying my 24x code a bit, I think I can do a similar pattern matching setup, for both the crank and cam signals.
58 zeroes followed by a single one. Measure low and high, multiply high by 2 (or bit shift by 1 for 2x, that's faster), same < or > compare. Since the tooth decoded 0 is a different size, RPM/VE math would either skip that tooth, or do different math. I don't like that last part; missing tooth wheels suck. Might do every 3rd tooth, that interval is the same as the missing teeth gap plus 1 normal tooth. My sensor averaging and the majority of loop code relies on that even spacing.
A little more complex if statement for cam, the pattern being a continuous 0011001100110011.
if 00 or 01, cam phase A. if 11 or 10, cam phase B.
Loop code could probably decode cam outside interrupt.
I'll probably throw something out based on the 24x code at some point.

Re: 58x ECU

Posted: Fri Jun 20, 2025 12:12 am
by AngelMarc
Yeah, it'll effectively have 20 sensor samples per revolution. Easiest way I can think right now to deal with missing teeth.
That means cylinder pattern match will be async of sensor samples, for V6 full sequential support.
v6...... 20/3 = 6.666666666 .. 60/3 = 20
v8...... 20/4 = 5 ................. 60/4 = 15
V10..... 20/5 = 4 ................ 60/5 = 12 ..... That would be new compared to 24x ECU.
The 24x code already updates sensor data more often than pattern match; so async shouldn't be a big deal.

Re: 58x ECU

Posted: Fri Jun 20, 2025 10:54 pm
by MPC001
Am sure you will come up with something more efficient @AngelMarc, but this works for me for 58X/4X.

Code: Select all

void loop(){ 
	for (x = 1; x <= 120; x++) {
	if ( x <= 58 || x >= 61 && x <= 118 ) { 
        CRK_ON;
        delayMicroseconds(frq1);
	CRK_OFF;
        delayMicroseconds(frq1);
	}
        if ( x == 59 || x == 119) {
        delayMicroseconds(frq1*4);
        } 
	if (x == 25 || x == 55 || x == 85 || x == 115)  {
	CAM_ON;
	}
	if (x == 1 || x == 50 || x == 80 || x == 90) {
        CAM_OFF;
        }
 	}
    }
    

Re: 58x ECU

Posted: Sat Jun 21, 2025 12:01 am
by AngelMarc
Certainly won't use delay().
will be a "n++" though. Probably a few.
Haven't actually started yet.

Re: 58x ECU

Posted: Sat Jun 21, 2025 2:10 pm
by MPC001
AngelMarc wrote: Sat Jun 21, 2025 12:01 am Certainly won't use delay().
will be a "n++" though. Probably a few.
Haven't actually started yet.
:thumbup: