C
C
C
Piston
HV Supply
Magneto
(AC CDI)
Spark
HV Supply 300-400V Capacitor Plug
DC-DC (DC CDI) HV Supply
12V Battery Converter SCR
SCR Gate
+ Control
Pick-up signal Signal
from ƉƵůƐĞƌcoil Conditioning -
Thermistor
Throttle MCU
MULTIPLE PIP SYSTEM The first positive and negative pulses can be used for
calculating the RPM of the engine. The second positive
In a multiple PIP system the pulser coil provides more
pulse can be used as a reference point for deciding the
than one alternating pulse. The pick-up signal for the
firing angle for higher speeds.
dual PIP system is shown in Figure 4, along with the
TDC and the firing range. The second negative pulse is
the reference point before TDC. This is the minimum
firing angle at which the spark should be generated for
engine speeds below idle speed.
PWM
+ CCP CCPRx
Pick-up signal Signal (Capture)
from pulsĞr coil Conditioning -
INT
SCR Gate
CDI LOGIC
Thermistor Control
ADC Map
Throttle RPM Calculation
Selection
RPM
Firing Angle to
Firing Angle
Timer Counts
Calculation
Conversion
CCP
I/O
(Compare)
PICΠ MCU
Timer1 CLK
f = -----------------------------------------------------------------------
signal Timer1 Prescaler CCPRx
Timer1 CLK
RPMEngine = ----------------------------------------------------------------------- 60
Timer1 Prescaler CCPRx
Where: Timer1 CLK = Clock input for Timer1 using T1CON register = Fosc/4 = 32/4 = 8 MHz
Timer 1Prescalar = Timer1 clock prescaler selected in T1CON register = 1:8 = 8
CCPRx is the captured value of Timer1 at falling edge of fsignal
fsignal is input signal frequency of the pick-up signal
60 scalar value is multiplied to convert Hz to RPM, RPMEngine = fsignal * 60
15
Set PERIF
SSEL Divide by Period
ATxRES+1 Counter
R R
ATx_perclk
PRP
LC4_out 111
PREC 15
LC3_out 110 ATxMISS
LC2_out 101
+ Divide by 2
LC1_out 100 Sync ATxsig LD ATxPER Difference
ZCD1_out 011 (2 Clocks)
-
15
C2OUT_sync 010 1 0 APMOD
C1OUT_sync 001
PPS 000 MPP ATx_missedpulse
Comparator
ATxINPPS
PHP
PS 1 Clock
CS Delay
ATx_phsclk
HFINTOSC (16 MHz) 1 Divide by Phase
Prescaler ATxclk
FOSC 0 ATxPER+1 Counter
R R Set PHSIF
ATxclkcc
10
To Capture/
Compare
Instruction
LD ATxPHS
Clock
Period
fsignal
AT Phase Pulse
ATxPER
AT Period Pulse
360°
ATxPHS
0°
AT clock
AT = -------------------------------
phaseClock ATxPER + 1
32000000
ATxPER = ----------------------------------------------- = 355.55555555556 355 and
1 359 + 1 250
32000000
ATxPHS = ----------------------------------------------- = 359.55 360
1 355 + 1 250
MULTI-PULSE MODE
In AT Multi-Pulse mode, the input signal contains more
than one pulse per cycle, as shown in Figure 9 as
fsignal.
15
PREC ATx_perclk
LC4_out 111 PRP
15
LC3_out 110 ATx_missedpulse ATxMISS
ATxperiod
LC2_out 101
+ Divide by 2
LC1_out 100 Missing ATxsig
ATx_in
Pulse Period LD ATxPER Difference
ZCD1_out 011 Trigger -
15
C2OUT_sync 010 1 0 APMOD
C1OUT_sync 001
PPS 000 MPP ATx_missedpulse
Comparator
ATxINPPS
PHP
PS 1 Clock
CS Delay
ATx_phsclk
HFINTOSC (16 MHz) 1 ATxclk Divide by Phase
Prescaler
FOSC 0 ATxPER+1 Counter
R R Set PHSIF
ATxclkcc
10
To Capture/
Compare
Instruction
LD ATxPHS
Clock
Period
fsignal
AT Phase Pulse
AT Missing Pulse
AT Period Pulse
ATxPER
360°
ATxPHS
0°
To determine the period of input signal, the signal must Since the ATxPER value resets every external pulse
have at least one missing pulse. As indicated in except for the pulse after the missing pulse, the
Figure 9, there are five signal pulses with one missing ATxRES should be chosen so that ATxPHS should not
pulse which makes it six pulses per period. A missing cross the maximum count of 1024 (10-bit register which
pulse is generated by the AT when no pulse is detected is 210).
after the fifth one. After the missing pulse, the first rising A Multi-Pulse mode example, Example 2, shows
edge on fsignal gives the AT period pulse output. Hence, choosing the resolution register (ATxRES) value for the
the missing pulse and the period pulse have exactly the required angular resolution (AR).
same length. The ATxPER register updates on every
rising edge of the external pulse, except for the pulse The instantaneous values of period and phase
immediately following the missing pulse. This helps registers in Multi-Pulse mode can be given as shown in
ATxPHS to correct itself according to ATxPER after Equation 5.
every rising edge in order to output phase pulses
correctly within the same period.
ATxCLK
ATxPER = --------------------------------------------------------------------------------------------------
AT f ATxRES + 1
Prescalar pulse
ATxCLK
ATxPHS = -------------------------------------------------------------------------------------------------------------------------
AT f ATxPER + 1
Prescalar Mis sin gPulse
fpulse
ATxPHS max = ATxRES -------------------------------------
mis sin gPulse
f
250 360
ATxRES = 360 ------------ – 1 = --------- – 1 = 36 – 1 = 35
2500 10
32000000
ATxPER = ----------------------------------------------- = 355.55555555556 355
1 2500 35 + 1
32000000
ATxPHS = ----------------------------------------------- = 35.955 35
1 250 355 + 1
Spark
200-400V Capacitor Plug
DC-DC HV Supply
12V Battery Converter SCR
Ignition
Coil
PWM
SCR Gate
Control
CWG I/O
Angular Timer
Capture
+
Phase
Pick-up signal Signal Compare
from pulser coil Conditioning - CLC AT
Input ATxCCy
AT Period Pulse
Firing Angle
SMT SMTxCPR
CDI LOGIC
Thermistor
ADC Map RPM
Throttle Selection Calculation
RPM
Firing Angle
Calculation
Math Accelerator
PIC16F161x MCU
RPM Calculation
The RPM of the engine can be calculated from the
external signal frequency fsignal as shown in
Equation 8.
TDC
+5to15V +ve
Period
Advance
pulse
Pick-up Signal
Pulser output -ve
Reference
-5to15V pulse
Input signals +5V
to p_PIP
MCU After
signal +5V
n_PIP
conditioning
AT Period Pulse
SMTxCLK
fsignal = ------------------------------------------------------------------------
SMT Prescalar SMTxCPR
SMTxCLK
RPM = ------------------------------------------------------------------------ 60
Engine SMT SMTxCPR
Prescalar
Where: SMTxCLK = clock input for SMT using SMTxCLK register= Fosc = 32 MHz.
SMTPrescalar = SMT clock prescaler selected in SMTxCON0 = 1:8 = 8.
SMTxCPR is captured value of SMTxTMR at window input event.
fsignal is input signal frequency to AT and SMT.
60 scalar value is multiplied to convert Hz to RPM, RPMEngine = fsignal * 60.
y 2 – y1
y = y + x – x -----------------
1 1 x –x
2 1
Where: y is the instantaneous value of the firing angle to be calculated, which is in between y1 and y2.
x is the instantaneous value of engine RPM which is known and in between x1 and x2.
(x1, y1) and (x2, y2) are the successive points in the graph between which a line is drawn these are
shown as row 1 and row 2 in the firing map table, respectively.
x1 and x2 represent values of Engine RPM of two endpoints. y1 and y2 represent the values of the
firing angle of two endpoints of a straight line curve.
1 1
FOM = 100 --------------- = 100 ------- = 500
Error 0.2
ATxCLK ----------------------------------------
32000000
ATxRES = -------------------------------------------------------------------------------------------------------------- – 1 = 1 500 166.66- – 1 = 383
max AT
Prescalar
ATxPER f
min signal_max
ATxCLK 32000000
ATxPER = ------------------------------------------------------------------------------------------------------------------ = ----------------------------------------- = 533.33
AT Prescalar ATxRES + 1 fsignal_max 1 360 166.66
Suppose ATxCLK = 32 MHz, ATxRES = 60, ATxPER max = 32767 (15-bit counter), hence fmin is calculated as
shown below:
ATxCLK
f min = -------------------------------------------------------------------------------------------------------------------
AT Prescaler ATxRES + 1 ATxPERmax
As a result, for the case above with ATPrescalar = 1, fmin is 16.27 Hz or 976 RPM.
To include lower RPM, if ATxCLK = 16 MHz and ATPrescalar = 8 are selected, the value will be calculated as
follows:
16000000
f min = ------------------------------------ = 1.017 Hz 60 RPM
8 60 32767
SCR/IGBT FIRING
The calculated firing angle is loaded into the AT
compare register. When the value in the compare
register matches the AT phase counter, a compare
interrupt is generated and IGBT or SCR is fired, as
shown in Figure 13. In case of IGBT, another compare
register is used to switch off the firing.
TDC
+5to15V +ve
Period
Advance
pulse
Pick-up Signal
Pulser output -ve
Reference
-5to15V pulse
AT Period Pulse
360°
ATxPHS
Phase Counter
0°
Advance Angle ΘA
FIRMWARE
Firmware flowchart is shown in Figure 14.
Start
Initialize
NO
SMT1 Int? & ADC Int? & AT period Int? NO AT1CC1 Int? NO AT1CC2 Int?
NO NO FAU = 1? NO
FAU = 3? FAU = 2? & FAU = 0?
NO
YES YES
Y ES YES YES YES
YES
Calculate RPM Select Firing Map Ignition coil Ignition coil
from SMT timer Mode = Mode = using Temperature Set Switch ON Switch OFF
NO
Thermister? Throttle? and Throttle AT1CC1 = On Firing Angle
AT1CC2 = Off Firing Angle
Set FAU = 2
YES YES
Get ON and OFF
Convert ADC to Convert ADC Set FAU = 3
firing angles
Temperature to Throttle
from MAP
Set FAU = 1
Note 1: FAU is a firing angle update variable which keeps track of the firing angle calculation step number.
When it is done, update the ON and OFF firing angles.
2: The ADC will sample the engine temperature and the throttle position for each AT period pulse. These
will be taken as current parameter values, and a firing map is selected based on these values.
Table 4 summarizes the performance comparisons of the two methods for CDI implementation.
FIGURE 15:
Spark
300-400V Capacitor Plug
DC-DC HV Supply
12V Battery Converter
SCR Ignition
Coil
PWM
CWG
SCR Gate
Control
I/O
Spark
Capacitor
+ Plug
Pick-up signal Signal
from pulsar coil Conditioning -
PIC16F1615/19
SCR Ignition
Coil
Thermistor I/O
SCR Gate
Control
Throttle
ATxCCy = –
y = y1 + x – x 1 m
Where: m = (y2–y1)/(x2–x1).
m is the slope of straight line between
(x1, y1) and (x2, y2).
RPM 10000
f = ------------- = --------------- = 166.666667 167
60 60
f 167
f = -------------- 32767 = --------- 32767 = 10687.21461 10687
Q15 f MAX 511
25
= ---------------- 32767 = ------ 32767 = 13002.77778 13002
Q15 MAX 63
EXAMPLE C-2: FIRING ANGLE CALCULATION IN Q15 FORMAT WITH CONVERSION FROM Q15
TO DEGREES
By using the values given in Example 3 and performing Q15 calculations, the following results are obtained.
RPM 1915
f = ------------- = ------------ = 31.91666667 32
60 60
f 32
f Q15 = -------------- 32767 = --------- 32767 = 2046.6 2046
f MAX 511
10
Q15 = ---------------- 32767 = ------ 32767 = 5201.111111 5201
MAX 63
Hence, from Table C-1 and the above calculated values, the results are shown here:
y1Q15 = 5201, xQ15 = 2046, x1Q15 = 1924, m = 37, Q15 MAX = 32767. Using Equation C-1 y can be calculated as
shown:
These results match the results in Example 3, Firing The final output of the second operation can then be
Angle Calculation Using Interpolation. shifted logically to the right 15 times to make the
The integer math above can easily be done with the division by 32767.
Math Accelerator. The result in the above example
contains Equation 10 operation twice. The first multiply/
add operation is [(2046-1924)x37] in numerator. The
second multiply/add operation is adding the result of
the first operation to 5201, which is multiplied by 63.
V = V G
Equation E-1 can be used to find the linear speed of the Automobile Engine
engine as shown below:
Where: VAutomobile is the automobile linear
velocity or speed in meters/second.
G is the gears’ turn ratio of engine rotation
and the automobile wheel rotation.
To install MCC, go to Tools Plugins Available Plugins MPLAB X Code Configurator Install. To start and use
the MCC after installation, go to Tools Embedded MPLAB Code Configurator.
As shown in Figure G-1, the GUI has a table on the left 2. The application has a menu labeled
consisting of three columns: “Application” on the left topmost corner. Upon
• Engine speed in RPM clicking on it, it displays several menu options
• Firing Angle in Degrees such as “Clear All” and “File”. The “Clear All”
• Dwell Time in µs menu option clears all settings done by the user
in the Engine Settings area and the table. It
There are two text boxes labeled “Application resets the GUI to it’s default state. The File
Messages” and “Application Debug Information”. menu has two options: Save and Load. The
“Application Messages” displays errors and any Save option saves the engine information
messages during the operation. “Application Debug entered by the user in a file at a user-specified
Information” displays the user with real-time engine location. The Load option loads the engine
parameters like engine speed, firing angle, information file from a user-defined location.
temperature and throttle position.
FIGURE H-1: BLOCK DIAGRAM OF CDI WITH RKE, BIKE FINDER AND PASSIVE KEYLESS
ENTRY FUNCTIONALITIES
Spark
300-400V Capacitor Plug
DC-DC HV Supply
SCR
12V Battery Converter
Ignition
Coil
PWM SCR Gate
Control
I/O PKE+Immobilizer
CWG
Vehicle Finder
I/O LED and Buzzer
PIC16F161x MCU
RKE + BikeFinder
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.