LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Please help! I have no idea what I am doing

Solved!
Go to solution

I cannot save to anything below 8.0.  Save my attachement, then post it to the Downconvert VI Request thread.  Someone there will convert it to 7.1 for you.  Can you answer the questions I gave earlier about the flow of execution?  It just doesn't seem right to me.  But I rewrote the code exactly as it was before with the exception of replacing the buttons with timers to achieve automatic operation.

 

The button that was labeled "Gather Data" didn't cause any data gathering.  It caused a serial write.  Data is gathered in every loop iteration, regardless of any buttons, by the serial read.  Some processing takes place in the top case structures on every loop iteration, regardless of any buttons.  Process Data only happens after Gather Data is activated.  Can you explain the difference between the processing in the top case structures which run every loop iteration, and the Process Data case that runs only after the serial write?

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 27
(1,674 Views)

I can tell you exactly how it worked on the front panel before. First I would select the correct port that the data was coming through. The data comes through a USB that is connected to the gages. Then I run the program. To start collecting data I had to push the collect data button. That would start taking the temperature and frequency measurements. Then after a short amount of time I would have to click the process data button.  Basically, the process data takes the data and determines the frequency from it. The receiving data LED type thing just flashed when data was coming in. I don't think that has anything to do with the program other than an indicator that would be no longer needed in this new program. Also the process data button had to be pressed in order for the detected frequencies to show up. Therefore, the frequencies must be determined every time the collect data button was pressed or the data would be lost.  I hope this answers your question, if not let me know and I can get back to you.  Thank you so much for your help. I am going to have to give you something for all your help.

0 Kudos
Message 12 of 27
(1,666 Views)

Good, I understand that part.  But what about the top part that has one case structure nested into another? When the outer case is True and the inner case is True, there is some division, subtraction, natrual log, and a bunch of other basic arithmetic functions that get the thermistor resistances and temperature values.  Does this need to run every time the USB is read, or just the same time as Process Data (getting the frequency)?  When the outer case False and the inner case is true, the data buffer gets filled and the sample count gets updated.  Again, does this need to run every loop after the USB is read?

 

I'm asking because I think I can make the code simpler and better.  Tell me a little more about how your system operates.  When you request to collect the data, some command is written to your device through USB.  Then the device returns some data.  How much data?  Is it a continuous stream of data?  After all the data is returned, does the device keep sending something, like idle data or null data, that you must collect.  Or does the device stop sending data until the command is sent again?  The reason I ask is because you have a serial (USB) read function that is constantly executing.  If there is no more data being returned, why keep trying to read.  I could change the execution so that the read only takes place after the write.  This seems more logical.  It would make the code easier and more readable.

- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 27
(1,662 Views)

All of the division, subtraction, natural log, and arithmetic functions are used to determine the temperature based on the thermistor resistance.  These values can be run at the same time as the process data takes place as long as the USB is still able to send the thermistor resistance.  As for when the outer case is False and the inner case is True, I am not sure about that because I really don't understand what is going on there.

 

I don't think that the USB has to keep sending data. The reason I said 10 seconds was that the receiving data part seems to take about 3 seconds before it is done and the processing data can then be completed.  The 10 seconds gives it a little extra time, just in case.  There is no reason to keep reading after all data is received (which takes about 3 seconds), at least to my knowledge of the system.  Like you said, it doesn't seem reasonable for it to keep trying to read data when there is none to read.  I don't think that the data is a continuous stream because the receiving data LED would flash off and on immediately after pressing the collect data button.  It would then stop after about 3 seconds as I have discussed above.

 

I hope this helps. It is really tough to explain when I am unaware of some of the aspects of it.  Any other questions that you need answered, just let me know. I can't believe this mess was left behind. I am so glad that there are people in this world like you that are willing to help other people when they are in a need.  Thank you!

0 Kudos
Message 14 of 27
(1,653 Views)

What I gave you earlier should work.  But I am going to attempt to make it more clean, like not reading the USB constantly.  Only after the request for data has been sent.  This will make the code more clean.  However, I'm have a lot to do right now on my regular job, so I probably won't get it done until next Monday or Tuesday.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 15 of 27
(1,636 Views)

The code that you gave me does not seem to work. It gave me an error code in the error out of -1073807298. The sample count is -1 and all the databuffer is 32678. There are no temperatures, resistances.  Also, the receiving data led does not ever light up.  I don't think that it is receiving any data through the USB. Any help with this is appreciated. Thanks.

0 Kudos
Message 16 of 27
(1,580 Views)

Sounds like you have serial IO problems.

 

Check your USB hub.. or USB connection..  I doubt the problem is tbob's code. 

0 Kudos
Message 17 of 27
(1,576 Views)

I checked the USB connection and the device is working fine. I ran it manually using the previous program and everything is hooked up right. Maybe something changed when I got converted it to a different version?

0 Kudos
Message 18 of 27
(1,567 Views)

I think I found the problem.  In the original program, the Write Buffer has the hex string "BE" in it.  I forgot to check the display setting.  It is set to Hex Display.  In my code, I am using a Normal Display string.  The wrong code is being sent to the device, and it will never return data.  That is why the sample count is -1 and the data buffer contains what it was initialized with at the beginning of the code.

 

To fix, right click on the Write Buffer control on the front panel.  Select Hex Display from the pop up menu.  Overwrite what is there with "BE" (no quotes just BE).  Right click again on the control and select Data Operations - Make current value default.  Save the vi.  Run it.  It should work.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 19 of 27
(1,552 Views)

tbob...

 

what are we going to do with you... slipping up like that.. 😉

 

.... as if I've never slipped up!  LOL!!!   okay... let's not compare our slip up ratio... I don't want to be embarrased.  😉  😛

0 Kudos
Message 20 of 27
(1,547 Views)