Code mod: inverting fastidle output

This is a forum for discussing the development and testing of alpha MS2/Extra code. Documentation
(Runs on MS2 and Microsquirt)

Moderators: jsmcortina, muythaibxr

Post Reply
msoultan
Super MS/Extra'er
Posts: 1021
Joined: Sun Jun 27, 2004 12:04 pm
Location: Long Beach, CA - USA

Code mod: inverting fastidle output

Post by msoultan »

I'm looking to make a slight modification such that fastidle turns on when it reaches the cutoff point, instead of turning it off.

Code: Select all

if(IdleCtl == 1)  {
	if(outpc.clt < flash4.FastIdle)
	    *pPTMpin[2] |= 0x04;             // turn on fast idle solenoid
	if(outpc.clt < flash4.FastIdle - flash4.IdleHyst)
	    *pPTMpin[2] |= 0x04;             // turn on fast idle solenoid
	else if(outpc.clt > flash4.FastIdle)
	    *pPTMpin[2] &= ~0x04;            // turn off fast idle solenoid
}
Looking at the above code, it would seem like all I need to do is switch around the '<' and '>' signs.

The only thing I didn't know is if I need to swap the '<' for the hysteresis.

Honestly, I don't know what that hysteresis code actually does. Assuming the fidle value is 160 and the hysteresis value is 5 a temperature of 159 will turn it on and a temperature of 160 will turn it off. If it hovers up and down around there, it's still going to turn on and off.. I don't get it.. or I'm looking at it wrong?

Thanks!
Mike
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Code mod: inverting fastidle output

Post by racingmini_mtl »

No wonder you don't get it: the code is wrong. The hysteresis is not really implemented with the code above. The first 'if' that turns on the fast idle solenoid should be removed:

Code: Select all

if(IdleCtl == 1)  {
   if(outpc.clt < flash4.FastIdle - flash4.IdleHyst)
       *pPTMpin[2] |= 0x04;             // turn on fast idle solenoid<br>
   else if(outpc.clt > flash4.FastIdle)
       *pPTMpin[2] &= ~0x04;            // turn off fast idle solenoid
}
So now if you want to invert the behaviour, you can just switch the '<' and '>' signs around as you proposed.

Cheers,
Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
msoultan
Super MS/Extra'er
Posts: 1021
Joined: Sun Jun 27, 2004 12:04 pm
Location: Long Beach, CA - USA

Post by msoultan »

haha.. that had me so confused! Thanks for the help! I posted a message on the MSEFI forums as well letting them know about the error.

Thanks!
Mike
cmcook
Helpful MS/Extra'er
Posts: 39
Joined: Sun Nov 21, 2004 3:56 am
Location: Melbourne, Australia

Post by cmcook »

Can't you just turn FIDLE off and then set it in Output Ports? I am using the FIDLE output to switch my fan relay on when above a set temperature. No need to fiddle with code.....
msoultan
Super MS/Extra'er
Posts: 1021
Joined: Sun Jun 27, 2004 12:04 pm
Location: Long Beach, CA - USA

Post by msoultan »

cmcook wrote:Can't you just turn FIDLE off and then set it in Output Ports? I am using the FIDLE output to switch my fan relay on when above a set temperature. No need to fiddle with code.....
thank you so much for that suggestion! I've never played with the Output Ports before. Makes life much easier!

Thanks!
Mike
Post Reply