01-23-2007 04:16 AM
01-24-2007 11:32 AM
Hi Mozill,
Here's one take: So it looks like you want to write one of two strings across your serial port, depending on whether you're reading temperature or humidity. Since these commands to your instrument are fixed, you should be able to have these commands as string constants in your block diagram. Then, depending on which reading you select on your front panel (say, a toggle button between temperature and humidity), you can pass the corresponding string constant to your serial write block. To do this, a "Select" function would be useful. You can get this funtion from your block diagram (Programming>>Comparison>>Select). Essentially, the user will select whether they would like to read temp. or humidity. Based on this selection, we'll send that command constant serially to the instrument.
Then, when you read in your data from the serial port, you can send the information into a case statement (the selector for this case statement is also the output from the toggle switch on your front panel that chooses temperature or humidty) and within one of the cases you'll have the formula for the temperature reading and in the other you'll have the formula for the humidity reading.
Hope this helps!
01-24-2007 01:37 PM
01-25-2007 05:42 PM
01-26-2007 07:21 AM
01-26-2007 09:58 AM
01-27-2007 04:34 PM
01-29-2007 11:56 AM
01-31-2007 10:15 AM - edited 01-31-2007 10:15 AM
Message Edited by Mozill on 01-31-2007 10:18 AM
01-31-2007 01:18 PM
Hi Mozill,
It sounds like you're almost there. You can definitely have a separate button for port settings, humidty, temperature & whatever other sub-program you want to run. For each button you have you'll create a new event for that button (right-click on the event case at the top of the event structure and select to Add Event). In the pop-up box that follows, you'll want to select your button control on the left-hand side and on the right hand side you'll choose the event for that button (typically value change should work fine). This will create a new event case in the drop down menu of your event structure. In this event case you'll put all the code you want to execute when that button changes value. If you need data to be passed from one event case to another (like the COM port settings need to be passed between the "Set Port Settings" event and the "Temperature" or "Humidity" events), you can use shift registers on the while loop to "store" that information for you from loop iteration to loop iteration. The Acquire, Analyze and Present vi you referenced is a great resource. You may want to start there. Save the example under another name & then add in your functions one by one. Hope this helps!