LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Implement heartbeat in FPGA vi to detect improper shutdown of host vi using compactRIO?

Solved!
Go to solution

Hi,

 

I'm developing an application for compactRIO. I want to implement a heartbeat in the FPGA code which detects if the host vi has aborted. I also want the FPGA vi to shutdown with a stop command from the host vi. 

 

I've implemented the heartbeat signal in the host vi, and the heartbeat counter is located in a single cycle timed loop (SCTL) in the FPGA vi. However, I have other while loop(s) in the FPGA vi (b/c analog IO are not compatible with SCTL), and thus I need to stop multiple multiple loops with a stop command originating from inside the single cycle timed loop (as opposed to from a user input, which you can do with a local variable).

 

As I have it now, when i download and run the code to my compact RIO target, and I abort the host vi (as opposed to pressing the stop button), the code in the SCTL stops, but the other loop doesn't. Can someone help?

 

 

Download All
0 Kudos
Message 1 of 3
(2,421 Views)
Solution
Accepted by topic author Andrew_P

Greetings Andrew P.

 

I took a quick look at your code and while I'm not completely sure of the cause of the behavior you're experiencing, I did notice a couple of things in your FPGA code.  First, it seems like you are using an appropriate method to signal the other loop that the SCTL has stopped due to the heartbeat timeout.  Second, it seems like the logic around the heartbeat monitor might be a bit off.  Currently you are taking the current value of the Heartbeat control/input and comparing it with a value returned by the shift register using a Not Equals comparison vi.  This will detect a change in the state of that input if the shift register is providing the previous value of that input.  However, it seems that you are taking the value of the Not Equals comparison to feed to the shift register rather than the current value of the Heartbeat control.  What happens if you change this?

 

Regards,

 

Michael G. 

Michael G.
Applications Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Self-realization: I was thinking of the immortal words of Socrates, who said, "... I drank what?"
Message 2 of 3
(2,398 Views)

Thanks! Once I corrected the logic in the heartbeat timer, it worked as expected. I'm glad I was on the right track.

0 Kudos
Message 3 of 3
(2,386 Views)