Step 1
first is to select the adjustment switch: I go for a 10K potentiometer since it is cheap and I think it ca do all what I need. In order to give fashion to it, I like to call it as "MANETTINO" like Ferrari does for a similar stuff they have on the dashboard (by the way, manettino means "tiny handle").
Step 2
I try to define what I really need: I like to be able to change the TC threshold (I mean when it starts to work) and the sensibility (I mean how much strongly reduces the engine tourque).
Step 3
Potentiometer working definition:
- each 40° of potentiometer revolution I like to change the TC threshold as:
- inside each 40° of potentiometer revolution I like to modulate the TC sensitivity giving a progressive change in both sensitivity:
Step 4
The circuit to be added is quite easy: I add just one potentiometer from 5V to GND, the cursor is connected to the ADC_1 channel 0.
Step 5
Off-line calculation: in order to write the software I need to write down all the variables and try to build up a model: I use a spreadsheet - what else!
This is what I generate, I know is not so easy to understand, but it shows how the manettino position is converted to voltage and to ADC value and then to TC threshold and TC sensitivity:
Step 6
Now is time to think about the software changes. First I need a couple of new static variables:
- uiTC_Threshold
- uiTC_Slope
and then I need to configure the ADC_2 for cntinuous conversions, I use DAvE as usual:
I like to limit the "manettino" changes only when the bike is not running, therefore, in the OFF state I add the following lines:
uiTmp = ADC1_RESRA0; // Get latest Manettino value
if ( uiTmp > 150 )
{
uiTC_Threshold = 1000 + ((unsigned int)( uiTmp / 151 ) * 100); // 110% is 0.74V
uiTC_Slope = ( uiTmp % 151 ); // Remainder
} else {
uiTC_Threshold = 0;
uiTC_Slope = 0;
}
Step 7
I need now another timer to modulate the engine tourque as calculated by the TC, I use Timer_7 from the CC2 unit:
The selected resolution is 15.515 usec, therefore to conver the ADC value into timer counter value, I just need to multiply by 432:
// Traction Control Timer Calculation
CC2_vLoadTmr ( CC2_TIMER_7, uiTC_Slope*432 );
The last stuff is to toggle port P10.7: the software turns it on, the Timer 7 Interrupt Service Routine turns it off:
IO_vSetPin( IO_P10_7 ); // TC-OFF to HIGH
...
void CC2_viTmr7(void) interrupt CC2_T7INT
{
// TC-OFF signal to LOW after timer expires
IO_vResetPin( IO_P10_7 ); // TC-OFF to LOW
} // End of function CC2_viTmr7
Step 8
well, last step is to test it! I'll do tomorrow...
No comments:
Post a Comment