03-05-2021 05:21 PM
I created one library to handle our electronics device. Library functions are call with help of while loop and event structure. which is show in below pics.
The event structure is generate the custom event whenever event is trigger by User.
I would like to convert in API, which should be look like belfow image. Image which I found online at https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x37XCAQ&l=en-US
Here I attached library and LibraryTest.VI
Anyone suggest me how can I convert into API?
03-08-2021 07:44 PM
I am try to create the API for our instruments. I need some suggestion. How can I ceate the Vi to read the data from queue, and report to the User.
Whenever the datapoint is available at that time experiment notifier is generate the custom events. Here I attach the image, which show inside the while loop received data is decode using bundle, and show on graph.
I am trying to create the API for experiment. which is help to send command and received data in run time.
I would like to readingdata Vi. Any sugession how can I create the vi to read the data?
In general I would like to create read vi like below image, which is report to user the new data is arraived.
03-09-2021 04:00 AM
You can make a VI that registers for an event, and waits for the event. You don't need to put that in a loop. You can even add a time out event, to prevent waiting for ever. Note that a Vi with an event that has a time out event doesn't always work well if you use the VIs in another event structure though.
You can even register in one VI, pass the registration to another VI and catch the event there. The registration is what causes events to be buffered. So VI 1 can register for events, VI 2 can trigger the mechanism that sends the event, while VI 3 can catch the event.
You'd make your life a lot easier if you'd put all those VIs in a class. That would enable you to store data, like the event registration reference, in the class's private data. You'd also get a library header for free, although without the VI Icons it only helps a little.
03-09-2021 02:19 PM - edited 03-09-2021 02:39 PM
Thank you for suggesion. Currently I am doing same thing which you were talking about in point#2. I am resgistering the event in ExperimentNotifier and generating event from another vis. To handle that, event I am gone create another vi with event structure. which will handle event.
sorry but I still not get how can I hold the execution until user will call stop experiment command.
03-10-2021 02:27 AM
Y@sh001 wrote:sorry but I still not get how can I hold the execution until user will call stop experiment command.
That's typically not something a driver does. The driver takes (only) care or all instrument communication, then it's up to the user to use the VIs in her\his program. For instance by using the driver VIs in an event structure.
But if you must, you can pass a VI a control reference. In the VI, dynamically register for the control's value change event (with the Register For Events function). Wait for the dynamic event (or a time out). It's almost exactly the same as waiting for the user event, once you know how to use the dynamic events (search examples for dynamic events).