STM32 Interrupt and event---Interrupt and event difference http://blog.csdn.net/flydream0/article/details/8208463
This diagram is an external interrupt line or an external event line.,The signal line is marked with a slash in the figure.,Side Flag19Note of the typeface,Indicates that such lines are common19Sets.The blue dashed arrow in the figure,The transmission path of the external interrupt signal is marked.,First the external signal from the number1The chip pin enters,by number2The Edge detection circuit,by number3or door into the interrupt suspend request register,Last numbered4With the gate output toNVICInterrupt detection Circuit,This edge detection circuit is controlled by a rising or falling edge selection register, the user can use both registers to control which edge is required to interrupt , since the selection of the rising or falling edge is controlled by 2 parallel registers , so the user can select the rising or falling edge at the same time , and if there is only one register control , then only one edge can be selected .
Press Down is numbered3The OR Door,Another input to this or gate is the software interrupt/Event Register,From here we can see, software can take precedence over external signals to request an interrupt or event , ,, numbered 3
an interrupt or event request signal is numbered 3, Enter suspend request register The signal transmission path of interrupts and events are consistent ,, The level change of the external signal is recorded in the Suspend request register
The external request signal is finally numbered 4, Interrupt Controller issue an interrupt request , Then the request signal cannot be transmitted to the other end of the door ,
Understand the request mechanism for external interrupts,It's easy to understand the request mechanism of the event..Red dashed arrow in figure,The transmission path of the external event signal is marked.,External request signal is numbered3or behind the door,Enter Number5With the door,The function and the number of the door4Similar to the door,Control for introduction of event masking registers;A transition signal from the last pulse generator is transformed into a single pulse,Output to other function modules in the chip.from this picture, we can also know,Judging from the external excitation signal,interrupts and events can be the same as the origin of the students.The reason is divided into2part of,because interrupts are requiredCPUparticipation in the,A software interrupt service function is required to complete the result of an outage;but the event,is to generate a pulse by a pulse generator .,The result of this event is automatically completed by the hardware,Of course, the corresponding linkage components need to be set first.,such as causingDMAOperation, ADconversion, etc.;
Simple example: External/ oTriggerADTransformation,To measure the weight of an external item.;If you use a traditional interrupt channel,Need/ oTrigger to generate an external interrupt,External Interrupt Service Program startupADconversion , the AD conversion completes the interrupt Service program to submit the final result ; If the event channel is used, the I/O trigger generates an event , and then the ad conversion is triggered by the ad transformation, the Interrupt Service program submits the final result; in contrast, the latter does not involve software in AD triggering, And the response speed is also more block, if the use of event-triggered DMA operation, there is no software to participate in the completion of certain linkage tasks.
It can be as simple as that,Event mechanism provides a fully hardware auto-complete channel that triggers to produce results, do not participate in the software , load , hardware is always faster than software cpu an effective way to handle the event capability of the chip
STM32 Interrupt and event---Interrupt and event differences