LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HIGHLIGHT EXECUTION MODE

I have a LV to measure the weight on an electronic balance. Unfortunately it works WELL only in the HIGHLIGHT EXECUTION mode and not in the NORMAL mode.If I run the LV in HIGHLIGHT EXECUTION mode I get CORRECT readings ALL the time. In the NORMAL mode it gives CORRECT and ZERO readings. A friend told me that the computer is fast and the BALANCE is slow and no matter how you program the LV, it will always give correct and zero readings. He adviced me to always RUN in the HIGLIGHT EXECUTION mode. Is there a way to solve the problem? I have alrady tried ALL the LV timers! The LV is attached.
0 Kudos
Message 1 of 10
(3,674 Views)
Here is my guess:
You send "SEND" and you're supposed to get back a string with the weight, correct?
If so, then the problem is probably that you're not waiting enough before reading.
If, for example, the weight is 10 bytes long, you should wait before reading, or tell the read VI to read 10 bytes instead of using Bytes at Serial Port.

Using highlighting runs the program slower, which gives the balance the time it needs to respond. It is most definitely NOT recommended to run a program in highlight execution. That should only be used for debugging and testing a program. Maybe you should choose your friends more carefully ;).

BTW, a few comments:
1. If possible, use the VISA functions. The serial VIs are no longer supported.
2. Your diagram is a bit messy (The wires coming out of the for loop, the wires inside the loop in frame 2). You really should make sure your diagrams are clean and clear.
3. Speaking of the loop in frame 2, what exactly is it supposed to do?
4. There is need to configure the serial settings 10 times. Just move it out of the loop.

___________________
Try to take over the world!
0 Kudos
Message 2 of 10
(3,654 Views)
Hi,

Since I really had nothing to do today, I thought I take a shot at rewriting your application.

Your friend is both right and wrong in what he said. Your computer is running too fast without Execution Highlighting turned on to let your instrument send a reply. But you can program to not return zeros and you should not run in Execution Highlighting mode just to make your program work. That is a troubleshooting tool.

I had to make a few assumptions since I don't know what kind of instrument you’re using. Look at the new application. On the left is a node that configures the serial port. You'll notice a note that says Carriage Return and Line Feed in it. Using the VISA serial properties instead of the older serial port VIs you have allow you to specify a Termination Character. This will tell LabVIEW to watch what’s coming in on the serial port when you do a VISA Read and look for either a Carriage Return or Line Feed. Once it sees the one you specify, it stops reading and returns the data in the serial buffer. This should give you the entire message that your instrument sent. I don’t know what your instrument uses as a termination character, try looking in the manual and it should specify.

The attached should do the same thing your program does. Take 10 readings, plot the data, let you save it if you want and stop.

A couple notes. You were configuring your serial port before every reading. This is not necessary. Set it up once before everything and it ready to use. Also note on the right of the While loop there is a Close serial port function. You should always make sure and close anything you open. Also, you shouldn’t use the "STOP" function to stop a program. Using that would not let you save any acquired data as it aborts the program and does not let it finish anything. So I used a While loop with the Stop button and a loop counter able to stop it.

Hope this helps. Like I said, I had to make some guesses so it may not be exactly what you need. Let us know how it goes and if you need any more help.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 3 of 10
(3,653 Views)
I have tried your LV program but unfortunately it now gives a ZERO reading all the time. I believe the stop bits should be 0. Your program has stop bits 1
0 Kudos
Message 4 of 10
(3,614 Views)
I have tried your LV program but unfortunately it now gives a ZERO reading all the time. I believe the stop bits should be 0. Your program has stop bits 1. I tried to edit and change from 1 to 0. However I do not know how to edit that part of the program. It seems to be locked. How to unlock?
0 Kudos
Message 5 of 10
(3,613 Views)
It shouldn't be locked in any way. Make sure you're in Edit mode ("Operate>Change to Edit/Run Mode" or Ctrl+M).

According to the LabVIEW help, valid values for the Stop Bit property are 1, 1.5 and 2. If I try a 0 on the Stop Bit property, the node generates an error.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 6 of 10
(3,602 Views)
And repling to myself....

Looking at the Help info for the old Serial Port Init.vi from your original application, you'll notice that a 0 value on the Stop Bit terminal actually sets the Stop Bit to 1. The Help text is quoted below.

"stop bits is 0 for one stop bit, 1 for one-and-a-half stop bits, or 2 for two stop bits.D efault value: 1 bit"

You might try increasing the Timeout value on the Configure node, or try a different termination character. If niether of those do it, then your device may not use a termination character and you'll have to read and scan the data until you get an entire message. I can show you how ot do that as well is needed.

Let me know how that works out.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 7 of 10
(3,599 Views)
I have manage to go to the EDIT mode but I can edit the baud rate but I cannot edit the stop bit. This is because the stop bit contains choices so since there is no choice for 0, I cannot proceed. However I will try to increase the timeout.
0 Kudos
Message 8 of 10
(3,575 Views)
There is no such thing as 0 stop bits. Each RS232 transmission must start with a start bit and end with a stop bit. If you were to transmit characters without a stop bit, the receiving end would not know when one character ended and when the next one started because the number of bits per character can be 7 or 8, and then there could be a parity bit. Your problem is probably due to your device responding slowly. You should wait some reasonable amount of time before checking for Bytes At Serial Port. You could also put the Bytes At Serial Port in a loop and check it every 100 mSec or so until you see no more increase in the number of bytes, signified by reading the same number 10 times in a row. Use a shift register in the loop and compare the shifted value to the value just read. See attached vi.
- tbob

Inventor of the WORM Global
Message 9 of 10
(3,557 Views)
Since everyone is replying with their code, I will do the same...

The problem is here is not the "stop bits", your code is executing faster than the instrument can respond. By adding some delay to your code, it does the same job as using highlight execution.

However, there are a couple of things in your code that could be improved:

1. Try use the new VISA based Serial vis from now one, the older vis are no longer supported.

2. Avoid configuring your serial port at every execution of the loop. The general data flow should be "Configure---Write/Read Loop---Close Serial Port"

3. Use the Error In/Error Out to control the data flow of your code.

Try this code and make changes if necessary, adjust the delay time to let the instrument has enough time to respond.
0 Kudos
Message 10 of 10
(3,529 Views)