Can I make a generic interrupt handler in VisSim?
Answers
-
Submitted by Richd on Tue, 09/22/2009 - 20:34.
First create a compound block that contains the logic for your handler. This can be something simple like incrementing a counter, or as complex as you want. Generally, you want your interrupt handler to be short and sweet to avoid impacting other operations, but often it makes sense to put your entire controller inside the compound block so it runs with high priority and low jitter. For instance, the motor control algorithm for a sensorless motor controller should run as the ADC end of conversion interrupt handler.
To set up an interrupt handler for your compound block, CTRL+Right click on the compound and select Execute on Interrupt like so:then click Select ... to choose the interrupt that will fire execution of the compound block and its contents.
In the dialog below, the compound block will be invoked on the 8th End of Conversion performed by the ADC unit.VisSim will take care of enabling interrupts and inserting the function into the interrupt vector table.
An example that counts interrupts on GPIOA0 is attached below.0