Jump to content

SubVI help please


Recommended Posts

Hi,

This is my first Labview project and I am struggling. I feel I ought to be able to pick up Labview much easier. I am trying to talk to a simple serial device (spectrophotometer) and get it to periodically measure and plot to 3 scrolling XY graphs on the front panel, and respond to simple commands such as calibrate, measure and export.

I started with the low level while loop which successfully measures, plots (sort of) and writes values to a file.

Then I started at the top to write a custom user event structure example - which also kinda works.

(1)My major problem is deciding how to integrate the two bits - deciding which should be in top level and which in subvi.

I would like:

The 3 XY plots to be visible all the time and to show updates in real(ish) time - I guess this means they should be in the top level - but that means they are also on the front panel of the subvi???

Measurement to occur automatically (1 min), but also to respond to top level pause and quit commands. I am confused how to utilize my top level user event - does it need to get passed to the subvi?

Where should I initialize the serial device?

Other problems:

Top level: (2) I don't know how to selectively just disable one of my user events - measure timer. I tried separating it with a different typdef file and use not a refnum constant but the error seem to say this was only for front panel events. Unregister seems to unregister all events for that refnum

(3) Quit button stopped working

(4) SubVI: Measurements may stop for hours, so I thought I could not use Charts without having a lot of zero values. I tried to use registers with XY plot to simulate a chart, but don't know how to scale this.

Any help would be appreciated.

Thanks,

Kathryn

Download File:post-1348-1105996219.zip

Link to comment
Hi,

(1)My major problem is deciding how to integrate the two bits - deciding which should be in top level and which in subvi.

I would like:

The 3 XY plots to be visible all the time and to show updates in real(ish) time - I guess this means they should be in the top level - but that means they are also on the front panel of the subvi???

Measurement to occur automatically (1 min), but also to respond to top level pause and quit commands. I am confused how to utilize my top level user event - does it need to get passed to the subvi?

Where should I initialize the serial device?

3550[/snapback]

Total brain fault now fixed.... My major problem was that I had never had a front panel and shift registers in a "subroutine", so I thought I had to somehow pass these up to the top level. My solution was to delete the while timing loop in the subvi and move the subvi's shift registers onto the top level's event loop; move all the XY graphs to the top level and just pass the 3 values for the graphs. The event timer then triggers the subvi at the required interval.

My second subvi was much less stressful :)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.