Synchronizing FPGA VIs and Host VIs Using Interrupts (FPGA Interface)

LabVIEW 2018 FPGA Module Help


Edition Date: March 2018
Part Number: 371599P-01
View Product Info

DOWNLOAD (Windows Only)


LabVIEW 2015 FPGA Module Help
LabVIEW 2016 FPGA Module Help
LabVIEW 2017 FPGA Module Help
LabVIEW 2018 FPGA Module Help
LabVIEW 2019 FPGA Module Help

Some FPGA targets allow you to generate interrupts from the FPGA VI to notify the host VI of events, such as data being ready, an error occurring, or a task finishing. To determine whether a target supports interrupts, access the FPGA Target Properties dialog box and locate the Target Information section of the General page.

Waiting for and Acknowledging a Single Interrupt

Complete the following steps to wait for and acknowledge a single interrupt in a host VI.

  1. Open a reference to the FPGA VI or bitfile that generates interrupts.
  2. Add the Invoke Method function to the block diagram of the host VI in the data flow where you want the host VI to wait for interrupts from the FPGA VI. Be sure to wire the FPGA VI Reference In input.

  3. Right-click the Invoke Method function and select Method»Wait on IRQ from the shortcut menu.
  4. Right-click the IRQ Number(s) input on the Invoke Method function and select Create»Constant from the shortcut menu. You also can create a control.
  5. Enter the value of the logical interrupt you selected in the FPGA VI.
  6. Wire the Timeout input if you want to specify the maximum time the host VI waits for the interrupt before continuing the data flow. By default, the host VI does not wait for an interrupt to occur and returns only interrupts already set by the FPGA VI. You also can wire a constant with a value of –1 to wait indefinitely for an interrupt. If you use the Timeout input, you can use the Timed Out output to determine whether the host VI continued data flow due to the timeout occurring or to the receipt of an interrupt. If a timeout occurs, the Timed Out output returns TRUE.
  7. Right-click the IRQ(s) Asserted output on the Invoke Method function and select Create»Indicator from the shortcut menu. LabVIEW creates a numeric indicator. A value of –1 indicates that the interrupt was not received.
  8. Add the Invoke Method function to the block diagram of the host VI in the data flow where you want the host VI to acknowledge the interrupt from the FPGA VI. Add the Invoke Method function to a Case Structure if you want the function to execute only when the host VI receives an interrupt. If you wire a Boolean constant of TRUE to the Wait Until Cleared input of the Interrupt VI, add the Invoke Method function to the data flow where you want to tell the Interrupt VI to stop waiting. Be sure to wire the FPGA VI Reference In input of the Invoke Method function.

  9. Right-click the Invoke Method function and select Method»Acknowledge IRQ from the shortcut menu. Use the Acknowledge IRQ method to acknowledge the logical interrupt returned by the Wait on IRQ method.
  10. Wire the IRQ(s) Asserted output of the Wait on IRQ method directly to the IRQ Number(s) input of the Acknowledge IRQ method.

Waiting for and Acknowledging Multiple Interrupts

Complete the following steps to wait for and acknowledge multiple interrupts in a host VI.

  1. Open a reference to the FPGA VI or bitfile that generates interrupts.
  2. Add the Invoke Method function to the block diagram of the host VI in the data flow where you want the host VI to wait for interrupts from the FPGA VI. Be sure to wire the FPGA VI Reference In input.

  3. Right-click the Invoke Method function and select Method»Wait on IRQ from the shortcut menu.
  4. Add an Array Constant to the block diagram. An array includes an index display on the left, an element display on the right, and an optional label.

  5. Add a Numeric Constant to the array.



  6. Using the Positioning tool, expand the array constant to the number of interrupts needed.
  7. Enter the values of the logical interrupts.
  8. Wire the array constant to the IRQ Number(s) input.
  9. Wire the Timeout input if you want to specify the maximum time the host VI waits for the interrupt before continuing the data flow. By default, the host VI does not wait for an interrupt to occur and returns only interrupts already set by the FPGA VI. You also can wire a constant with a value of –1 to wait indefinitely for an interrupt. If you use the Timeout input, you can use the Timed Out output to determine whether the host VI continued data flow due to the timeout occurring or to the receipt of an interrupt. If a timeout occurs, the Timed Out output returns TRUE.
  10. Right-click the IRQ(s) Asserted output on the Invoke Method function and select Create»Indicator from the shortcut menu. LabVIEW creates an array indicator. The IRQ(s) Asserted front panel indicator displays the number(s) of the interrupts the FPGA target asserts. An empty array indicates that no interrupts were received.
  11. Add the Invoke Method function to the block diagram of the host VI in the data flow where you want the host VI to acknowledge the interrupts from the FPGA VI. Add the Invoke Method function to a Case Structure if you want the function to execute only when the host VI receives an interrupt. If you wire a Boolean constant of TRUE to the Wait Until Cleared input of the Interrupt VI, add the Invoke Method function to the data flow where you want to tell the Interrupt VI to stop waiting. Be sure to wire the FPGA VI Reference In input of the Invoke Method function.

  12. Right-click the Invoke Method function and select Method»Acknowledge IRQ from the shortcut menu. Use the Acknowledge IRQ method to acknowledge the logical interrupts returned by the Wait on IRQ method.
  13. Wire the IRQ(s) Asserted output of the Wait on IRQ method directly to the IRQ Number(s) input of the Acknowledge IRQ method.

WAS THIS ARTICLE HELPFUL?

Not Helpful