วันอังคารที่ 8 พฤศจิกายน พ.ศ. 2559

การจุดระเบิดหัวเทียนThe program structure. The program consists of 5 sections: Declaration, Setup, Interrupt actions, Interrupt Service Routine and Loop. Declaration This is where all the variables are declared and deciding what data types they are and which pins to use. In this case we are manipulating the AVR processor built in Timers, so here is also where we include the AVR codes. Setup Here we setup all the variables in the terms of resetting, pointing out the pins and deciding if they are inputs or outputs. Her w also setup the interrupt functions to be used later in the program. The AVR timer no2 are set now and the correct type of interrupt service routine to be used with the timer are set. Interrupt actions This actions will happen when the hall sensors are exposed to the magnets on the crank. Interrupts are always interrupting the loop. There is one interrupt action for the rising trigger signal and on for the falling trigger signal. When magnet no 1 that has the north facing towards the sensor, flies by, the hall latches on and triggers the interrupt “SensorOn”. Deepening on the current rpm, the different things will happen. If the rpm is below 300, the Arduino will start the ignition system 2 straight away and start charging coil no 2 . If the rpm is over 300, ignition system 1 will start after the right amount of crank time has elapsed. The timer will be initiated to be able to count up to 1 millisecond and automatically start over again. Also the RPM calculations will happen here. The second Interrupt

ไม่มีความคิดเห็น:

แสดงความคิดเห็น