Can I make a generic interrupt handler in VisSim?

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by francois on Tue, 09/22/2009 - 19:24 

I just want to take an interrupt when a pin goes high. Can I do that? How is it done in VisSim?

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    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:

    CompoundExec-Interrupt.png

    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.

    Interrupt-select.png

    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.

    Unable to find an attachment - read this blog