VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Set input value from Custom Device

Solved!
Go to solution

Hi,

 

I am actually creating a custom device (asynchronous) that is controlling a climatic system. It consists in adapting a functionnal LabVIEW code to create the custom device. Unfortunately the LabVIEW code uses a lot of FGVs that act as inputs and outputs at the same time (it means that the system can change the value of an input).

 

So, I would like to know if there is an easy way to set the value of an input from the custom device engine code. I tried the following solutions without success :

 

  • Write into the FIFO of the input channel.
  • Use "Set Channel Value" of the NI VeriStand API -> I get the error -307970.

So, is there something I can do to facilitate my custom device creation ? instead of "re-thinking" the whole code which is a real pain in the *** because of the complexity of it ?

 

Thanks in advance.

Da Helmut
Voir le profil de Maxime M. sur LinkedIn - View Maxime M.'s profile on LinkedIn
0 Kudos
Message 1 of 6
(5,370 Views)

Hi,

 

I think you can do it from an Inline custom device, but you need to set the direction of your channel (flags) as readable and writable so you can do the both operations.

 

Best regards

Message 2 of 6
(5,367 Views)

Hi,

 

Yep but I can't use the inline template since my code isn't really deterministic and too slow. Using an inline one would require too much time. I can't afford it. Moreover there is more than one loop.

 

Regards,

Da Helmut
Voir le profil de Maxime M. sur LinkedIn - View Maxime M.'s profile on LinkedIn
0 Kudos
Message 3 of 6
(5,362 Views)
Solution
Accepted by topic author DaHelmut

Re,

 

We solved that by using the inllne part for only channel updating and defering the real treatments to asynchronous threads with data exchanges through FIFOs.

 

++

Message 4 of 6
(5,359 Views)
Solution
Accepted by topic author DaHelmut

This could be a solution. Didn't think about it....Thanks a LOT !

 

Da Helmut
Voir le profil de Maxime M. sur LinkedIn - View Maxime M.'s profile on LinkedIn
0 Kudos
Message 5 of 6
(5,357 Views)

Actually we use such apporach in our custom devices.There is a library, that helps with managing of  the asynchronous process.

You can look at the source f.e. of following custom device including the library: https://github.com/NIVeriStandAdd-Ons/CANopen-Master-Custom-Device

~Jiri

CLA, CTA, CLED

Message 6 of 6
(5,322 Views)