IE1206 Embedded Electronics PIC-block Documentation, Seriecom Pulse - - PowerPoint PPT Presentation

ie1206 embedded electronics
SMART_READER_LITE
LIVE PREVIEW

IE1206 Embedded Electronics PIC-block Documentation, Seriecom Pulse - - PowerPoint PPT Presentation

IE1206 Embedded Electronics PIC-block Documentation, Seriecom Pulse sensors Le1 Le2 I , U , R , P , serial and parallel Le3 Ex1 KC1 LAB1 Pulse sensors, Menu program Start of programing task Kirchhoffs laws Node analysis Two-terminals


slide-1
SLIDE 1

IE1206 Embedded Electronics

Transients PWM Phasor jω PWM CCP CAP/IND-sensor

Le1 Le3 Le6 Le8 Le2 Ex1 Le9 Ex4 Le7

Written exam

William Sandqvist william@kth.se

PIC-block Documentation, Seriecom Pulse sensors I, U, R, P, serial and parallel

Ex2 Ex5

Kirchhoffs laws Node analysis Two-terminals R2R AD Trafo, Ethernet contact

Le13

Pulse sensors, Menu program

Le4

KC1 LAB1 KC3 LAB3 KC4 LAB4

Ex3 Le5

KC2 LAB2

Two-terminals, AD, Comparator/Schmitt Step-up, RC-oscillator

Le10 Ex6

LC-osc, DC-motor, CCP PWM

LP-filter Trafo

Le12 Ex7

Display

Le11

  • Start of programing task
  • Display of programing task
slide-2
SLIDE 2

William Sandqvist william@kth.se

ECCP Compare mode

Trigger special event ( Reset TMR1 and AD GO )

slide-3
SLIDE 3

William Sandqvist william@kth.se

ECCP Compare mode

slide-4
SLIDE 4

William Sandqvist william@kth.se

Compare mode CCP-pin

Compare means that a 16 bit number in CCPR -registers continuously is compared with Timer 1's count. When the similarity occurs, the CCP pin will get high/low/unchanged depending on setting in CCP1CON.

  • The similarity can be programmed to additionally trigger interrupt.
  • NOTE that the CCP-pin TRIS-bit must be set to output, = 0.
slide-5
SLIDE 5

William Sandqvist william@kth.se

Compare mode special event

In addition to the impact on the CCP pin, it is possible to choose a "special event". For CCP1 this means that Timer1 will be reset, and the start of AD conversion (if the all other preparations for this is done in advance). Interruptions will not occur. The reset of Timer1 means that the period time/frequency change.

Start AD-conversion Reset TMR1

slide-6
SLIDE 6

William Sandqvist william@kth.se

  • Ex. Reset Timer1

/* fosc = 4 MHz, Timer1Period = 0,001 s (1000 Hz) */ /* Setup TIMER1 00.xx.x.x.x.x -- xx.00.x.x.x.x Prescale 1/1 xx.xx.0.x.x.x TMR1-oscillator is shut off xx.xx.x.0.x.x - (clock input synchronization) xx.xx.x.x.0.x Use internal clock f_osc/4 xx.xx.x.x.x.1 TIMER1 is ON */ T1CON = 0b00.00.0.0.0.1 ; /* CCPR = (fosc/4) * Timer1Period = 1000000*0,001 = 1000 */ /* CCPR = 1000 = 0x3E8 CCPR1H = 0x3, CCPR1L = 0xE8 */ CCPR1H = 0x3; CCPR1L = 0xE8; CCP1CON = 0b00.00.1011; /* --. 00. special event */ /* Timer1Period is now 1 ms */

Suppose we want Timer1 to hawe period time 1 ms (overflov 1000 times/s).

  • Special event means reset Timer1!
slide-7
SLIDE 7

William Sandqvist william@kth.se

Sampling Clock

  • If you have a control loop, it is important to have a

constant sampling rate. If you are promissed a pay increase with 500 kr/turn in a

  • loop. Then you would want to know if the turn is:
  • 500:-/hr
  • 500:-/week
  • 500:-/month

Timer1 with CCP-compare can start the AD-converter at equal time intervals!

Actuator Sensor

Micro controller

slide-8
SLIDE 8

William Sandqvist william@kth.se

slide-9
SLIDE 9

William Sandqvist william@kth.se

ECU, Engine Control Unit

  • Today is car engines

controlled by an ECU.

  • This is how a PIC-

processor would be used as a mini ”mini-ecu”!

( Internal combustion engines are in reality controlled with more powerful processors, but the IO devices are the same as for a small PIC processor. )

slide-10
SLIDE 10

William Sandqvist william@kth.se

The need of ignition advance

When the fuel/air mixture is ignited in the compression chamber, the combustion starts at the spark plug and spread from there further in the fuel/air mixture. It takes a certain time for the entire mixture to burn, expand and thus force the piston down. Therefore, one must start the ignition process (Z) before the piston reaches top dead center (TDC). This is what is called the ignition advance.

TDC

slide-11
SLIDE 11

William Sandqvist william@kth.se

The need of ignition advance

If the engine speed increases, the mixture will have shorter amount of time to burn. You therefore need to increase ignition advance with increased speed. The fuel/air mixture combustion rate varies with how full the cylinder is at the compression. At small throttle and high rpm the cylinder is less filled than with big "throttle" and low speed. There is also a need for different ignition advance at the same speed due to "throttle/engine torque". Z = f ( speed, torque )

TDC

slide-12
SLIDE 12

William Sandqvist william@kth.se

The mechanical solution

  • Speed, centrifugal

regulator. Breaker points.

  • Motor torque,

vacuum regulator. The control range with mechanical components. Spark plug.

slide-13
SLIDE 13

William Sandqvist william@kth.se

Distributor recurve kit

In the past you could "liven up" the engine with new weights and new springs and a changed vacuum advance …

slide-14
SLIDE 14

William Sandqvist william@kth.se

Embedded Electronic’s solution

  • The control range in the data memory!

You can for example choose between performance or environmental requirements …

slide-15
SLIDE 15

William Sandqvist william@kth.se

Sensors for speed and angle

The automotive industry has found a very inexpensive way to measure the motor shaft speed and angular position. An inductive pick up emits pulses as the motor rotates the starting ring gear, and another inductive sensor delivers a pulse per revolution when the "index pin" is passing.

slide-16
SLIDE 16

William Sandqvist william@kth.se

Angular position

Suppose that the ring gear has 130 teeth. To roughly keep track of the angular position, in principle "count" the teeth passing with a modulo-130 counter.

  • Timer0 can count pulses on pin T0CKI. You connect

the gear sensor to this pin.

T0IF

slide-17
SLIDE 17

William Sandqvist william@kth.se

Reference position

Timer0 is actually an eight-bit counter, ie a counter that "turn around" at number 255 and then starts over with the number 0.

  • You get a modulo-130-counter by att "load" Timer0 with the

number 126 when index-pin pass the sensor and generates INTF interrupt. 256-126 = 130

INTF

Assume that the index pin is located at the tooth number "0". PIC processor has an external interrupt input INT.

  • Index pin sensor is

connected to this input.

slide-18
SLIDE 18

William Sandqvist william@kth.se

Current angular position

Current “teeth” 0…129, can the main program know by reading TMR0 and subtract number 126. CogNo = TMR0 - 126;

slide-19
SLIDE 19

William Sandqvist william@kth.se

Rotational speed measurement

The speed measurement is by measure the time it takes for the teeth to pass the gear sensor. Rotation is not with constant speed because combustion engines are explosion engines so the measurement value varies from cog to cog.

  • Now there is a

measurement value!

CCPIF

slide-20
SLIDE 20

William Sandqvist william@kth.se

Rotational speed measurement

t1 t2

T n t t T 1

1 2

∝ − =

CCP-pin CCP-compare

At every cog Timer1 will be captured and the result will be in the CCP-unit registers CCPRH and CCPRL. The CCPR-register can be handled as a 16-bit number.

  • In principle, the measured time between two teeth passages is

the difference between the two time values, and the speed n is the inverse of this time.

slide-21
SLIDE 21

William Sandqvist william@kth.se

Sensors for motor load

The motor load is usually measured with analog sensors. PIC processors have ADCs that can read these sensors.

  • The accelerator pedal

position can be measured with a potentiometer.

  • A pressure sensor

can measure "the vacuum" in the intake manifold.

  • A hot-wire

anemometers can measure the amount of air to the engine.

slide-22
SLIDE 22

William Sandqvist william@kth.se

Igniton advance table

The relationship between the ignition advance and the speed and load, is complicated and is best described as a “map" ( Mapped ignition). Experimental one can place the vehicle on a "rolling road" and systematically changing speed and load, and for each combination "prove up" the best ignition timing. The measured values can be gathered in a ignition advance table.

slide-23
SLIDE 23

William Sandqvist william@kth.se

Visualize the table

Note that the table's values are "faked" and is intended as a principle example.

3-D plot with Matlab. (Copy the text and try it in the Matlab command window). Note that the table's values are "faked" and is intended as a principle example.

IgnAdv = [ 30 40 40 40 20 15 15 15 20 40 40 40 25 20 20 20 40 60 60 50 30 20 20 15 40 70 70 60 40 25 25 20 45 80 85 80 50 40 30 25 50 85 85 70 60 50 35 30 60 90 90 80 75 60 40 35 70 95 95 80 75 65 50 40 ]; surf(IgnAdv);

slide-24
SLIDE 24

William Sandqvist william@kth.se

Table in PIC-processor

static const char ignmap[]={30,40,40,40,20,15,15,15, 20,40,40,40,25,20,20,20, 40,60,60,50,30,20,20,15, 40,70,70,60,40,25,25,20, 45,80,85,80,50,40,30,25, 50,85,85,70,60,50,35,30, 60,90,90,80,75,60,40,35, 70,95,95,80,75,65,50,40 }; /* speed 3 bits 0...7 ; torque 3 bits 0...7 */ char speed, torque, IgnAdv, index; index = speed*8 + torque; /* index for 64 entries */ IgnAdv = ignmap[index];

  • How can a small table be programmed into the PIC

processor.

slide-25
SLIDE 25

William Sandqvist william@kth.se

Ignition

  • With help from Timer0 we know tha motor angular position.
  • With help from CCP-unit we know the motor rotational speed.
  • With help of analog sensors we know the motor load. When

When approaching the ignition point we look up the ignition advance value. To carry out the ignition at the right time you put the ignition advance value in the CCPR registers.

  • With CCP-compare

triggers to the event to ignite the spark!

slide-26
SLIDE 26

William Sandqvist william@kth.se

Carburetor or fuel injection

  • Carburetor. How many parts does

it contain? Count! Have you heard

  • f ”dirt in the carburator”?

Fuel injector. Much easier - and more reliable.

slide-27
SLIDE 27

William Sandqvist william@kth.se

Fuel injection

  • The last carburetor car left

the production line 1990.

  • Computer-controlled fuel injection has taken over in

combustion engines.

slide-28
SLIDE 28

William Sandqvist william@kth.se

There will be more CCP-units needed

This was intended as an example of how the CCP units could be used. (It is not Microchips Midrange PIC processors that control our car engines ...)

  • One CCP per spark plug
  • One CCP per cylinder
slide-29
SLIDE 29

William Sandqvist william@kth.se

What Embedded Electronic Engine Control has managed to do:

  • Smooth running
  • Optimum torque curve
  • High Power delivery
  • Outstanding cold start ability
  • Fuel consumption is reduced by 90 %
  • Numerous diagnosis facilities (faster repair at lower cost)
  • Anti-theft protection. Ignition lock electronic immobiliser.
  • Anti-lock braking system (ABS)
  • Drive by wire
  • Brake by wire
slide-30
SLIDE 30

William Sandqvist william@kth.se