ie1206 embedded electronics
play

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


  1. 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 R2R AD Ex2 Le4 Two-terminals, AD, Comparator/Schmitt Ex3 Le5 KC2 LAB2 Transients PWM Le6 Ex4 Le7 KC3 LAB3 Step-up, RC-oscillator Phasor j ω PWM CCP CAP/IND-sensor Ex5 Le8 Le9 LC-osc, DC-motor, CCP PWM Le11 KC4 LAB4 Ex6 Le10 LP-filter Trafo Display Le12 Ex7 • Display of programing task Trafo, Ethernet contact Le13 Written exam William Sandqvist william@kth.se

  2. ECCP Compare mode Trigger special event ( Reset TMR1 and AD GO ) William Sandqvist william@kth.se

  3. ECCP Compare mode William Sandqvist william@kth.se

  4. 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. William Sandqvist william@kth.se

  5. Compare mode special event Start AD-conversion Reset TMR1 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. William Sandqvist william@kth.se

  6. Ex. Reset Timer1 Suppose we want Timer1 to hawe period time 1 ms (overflov 1000 times/s). /* 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; • Special event means reset Timer1! CCPR1L = 0xE8; CCP1CON = 0b00.00.1011; /* --. 00. special event */ /* Timer1Period is now 1 ms */ William Sandqvist william@kth.se

  7. Sampling Clock Micro controller Actuator Sensor • 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 Timer1 with CCP-compare can • 500:-/week start the AD-converter at equal • 500:-/month time intervals! William Sandqvist william@kth.se

  8. William Sandqvist william@kth.se

  9. ECU, E ngine C ontrol U nit • 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. ) William Sandqvist william@kth.se

  10. 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. TDC Therefore, one must start the ignition process (Z) before the piston reaches top dead center (TDC). This is what is called the ignition advance . William Sandqvist william@kth.se

  11. 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 TDC 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 ) William Sandqvist william@kth.se

  12. The mechanical solution Breaker points. Spark plug. The control range with mechanical components. • Motor torque , • Speed , centrifugal vacuum regulator. regulator. William Sandqvist william@kth.se

  13. Distributor recurve kit In the past you could "liven up" the engine with new weights and new springs and a changed vacuum advance … William Sandqvist william@kth.se

  14. Embedded Electronic’s solution • The control range in the data memory! You can for example choose between performance or environmental requirements … William Sandqvist william@kth.se

  15. 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. William Sandqvist william@kth.se

  16. 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. T0IF • Timer0 can count pulses on pin T0CKI . You connect the gear sensor to this pin. William Sandqvist william@kth.se

  17. Reference position Assume that the index pin is located at the tooth number "0". PIC processor has an external interrupt input INT . • Index pin sensor is INTF connected to this input. 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 William Sandqvist william@kth.se

  18. Current angular position Current “teeth” 0…129, can the main program know by reading TMR0 and subtract number 126. CogNo = TMR0 - 126; William Sandqvist william@kth.se

  19. 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. CCPIF • Now there is a measurement value! William Sandqvist william@kth.se

  20. Rotational speed measurement t 1 t 2 CCP-pin CCP-compare 1 = − ∝ T t t n 2 1 T 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. William Sandqvist william@kth.se

  21. 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 • A pressure sensor • A hot-wire position can be measured can measure "the anemometers can with a potentiometer. vacuum" in the intake measure the amount of manifold. air to the engine. William Sandqvist william@kth.se

  22. 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. William Sandqvist william@kth.se

  23. Visualize the table 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); Note that the table's values are "faked" and is intended as a principle example . William Sandqvist william@kth.se

  24. Table in PIC-processor • How can a small table be programmed into the 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]; William Sandqvist william@kth.se

  25. 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! William Sandqvist william@kth.se

  26. Carburetor or fuel injection Carburetor. How many parts does Fuel injector. Much it contain? Count! Have you heard easier - and more of ”dirt in the carburator”? reliable. William Sandqvist william@kth.se

Recommend


More recommend