LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Program Not Running Without Highlight Execution Button

Hello everyone.

I have made the program for the wireless communication between LabVIEW and Touch panel. In that i have used the PROPERTY NODE and that will contain "Serialy Settings:Number of the bytes at the serial port ". Now when i am running the program with highlight execition button data pass to the touch panel. But when the Highlight Execution button is off the program runs but it not pass the data to the Touch panel. 

 

I know this is my silly question but it is my problem that make me confused pl help me. And also tell me that this problem is due to property node?

 

I am attaching my vi.

 

Thank you in advance.

 

0 Kudos
Message 1 of 21
(4,612 Views)

I think your VI demonstrates the classic problem people have when they use the Bytes at Port method when doing serial communication.  (I still think the NI serial example VI's are bad in that they only seem to demonstrate this method.)  Bytes at Port is the wrong thing to use about 90% of the time.

 

You write to your VISA port, then immediately check the bytes at port.  Since you just wrote the message, the device probably hasn't had time to respond, so the bytes at port is zero.  So you wind up reading zero bytes back.  When you use highlight execution, it slows down your code enough that it probably gives the device enough time to respond (whether it is the full message or not is another question.)

 

When using bytes at port, put a delay between the write and the check for the bytes at port so the device has enough time to respond.  Better yet, if the device sends back a termination character (and your serial config is set to look for the termination character of a line feed by default), get rid of the bytes at port, and just read back a number of bytes much larger than you ever expect to get.  The VISA read will terminate automatically when it gets the character.

 

Other problems you have.  You don't have a while loop, so your VI only executes once.  Also, you are doing multiple VISA writes and Reads simultaneously.  So any responses you get are going to be scrambeld among all the VISA reads.

 

I think you'd be better off searching the forums for numerous questions and answers about serial communication, read them, and discover what are the correct practices for serial communication (and compare to what you are doing wrong in  your VI.)

0 Kudos
Message 2 of 21
(4,605 Views)

Your code is full of race conditions. For example you create a single visa resource, then branch it into multiple parallel parts, after each, you clear and close in parallel. Once you close it anywhere, all other branches will also close. You need to ensure that all transmissions and other operations occur in a defined order.

 

Also how are you running this? Why isn't there a toplevel while loop around the core code? Are you using "continuous run" mode?

 

Obviously, right after writing, there won't be any "bytes at port", becaus the response takes time. You need to add a suitable delay. (under execution highlighting, things happen much more slowly, so bytes will arrive.

 

You also have way too much duplicate code. All your case structures are nearly identical, differeing only in a single string constant. All that belongs in the case structure is the string constant.

Message 3 of 21
(4,601 Views)

Thank you RavensFan and Altenbach  for rpl 

 

Here in my application i have to use single run for vi. 

 

I have used the multiple  while loop but it take so much time  to stop the vi. Should i use the single while loop in the case stucture of the write? And how to put delay i dont know. pl give me hint so that i can immplement. And i have modified the vi by deleting the property node which is attached. and now i m running the vi without highlight exectution button and i have wait for more than 10 min but data neigher displayed on the touch panel nor it rpl to lv. (sending data from lv that should be displyed on touch panel and its rpl is there in lv). and if i m pressing the stop button vi cant stop and i think that vi is hang so by using task manager i have to end task it. Also showing window "Resetting Again Without Property Node.vi"and getting error 1073807339 for VISA READ

 

Actualy i have exam on 25 and i have passed 2 months for Wireless communication between LV and Touch panel. I know its simple to put delay but i am not getting it. pl  get me out from this bunch of errors .reply me so that i can run my programSmiley Indifferent

0 Kudos
Message 4 of 21
(4,560 Views)

That's even worse.  Now you have the number of bytes you are writing connected to the number of bytes to read.  There is no correlation between those two values.

 

Does your device send a termination character such as the line feed?

 

Please do as I asked and search the forums for messages about serial communication.  What you are doing are mistakes numerous other people have done.  You'll be able to learn a lot from those message threads.

 

If you want a delay, wire the error wire or the VISA wire through a single frame flat sequence that contains the delay.  Even the poor serial examples that ship with LabVIEW show this.

0 Kudos
Message 5 of 21
(4,540 Views)

Start over.

You have 9 messages in the SEND case all fighting for the com port. How do you keep WEIGHT 1 message from walking over WEIGHT 4 or any of the others. Put your Write/Read in a none reentrant VI and call from your example. It will block and only allow one case to try to write and read from the com port

 

Also TERMINATION CHAR. You are sending a Line Feed and Carriage Return so I assume your device expects Termination Char. From that I assume YOUR device will send you a Termination Char telling you when it has terminated it's message. 

 

Research the termination of YOUR DEVICE that you are talking to.

Research the "Enable Termination Char (T)" VISA Configure setting.

Message Based Settings:Termination Character

Message Based Settings:Termination Character Enable

Message Based Settings:Send End Enable

Message Based Settings:Suppress End Enable

Serial Settings:End Mode for Reads

Serial Settings:End Mode for Writes

 

One last thing TERMINATION CHAR! What are the expected Termination Char you have to send and What are the expected Termination Char sent by your device.

 

Attached is a VERY VERY simple VISA Write/Read VI that will work if the TERMINATION CHAR and TIME OUT are set right. I use Termination Char on my reads, but do not automaticly used them on my writes. I prefer to add it myself as part of the write buffer (just like you have done).

 

In case I missed it, you need to reseach TERMINATION CHAR of your device.

 

OOPs the Line Feed should be a xA not x10 sorry

Omar
0 Kudos
Message 6 of 21
(4,533 Views)

Hello every one

In my project i am using the Delta Electronics DOPB03S211 HMI / Touch panel. I have remove the property node and run the vi for wireless communication, program is running and data are passed to the hmi and data is displayed on hmi. But the time between pass the data from lv and display on hmi is 2minute which is sooooo long. i want the data should pass from lv to hmi in miliseconeds. So why its taking so much time? what is responsible for this delay hmi or lv?

 

The termination character for my hmi is CR & LFand also i have increse the time out to 20000 for the timeout errror. But after running the program for 3 to 4 times again timeout error occurs what should i do? Running the program in continuous run.

 

So how should i reduce this time delay and time out error.

0 Kudos
Message 7 of 21
(4,496 Views)

I do not see how this even works correctly after reading back the first reply.

 

You have "VISA Close" after every single VISA read. Who ever gets there first is the only Write/Read that will work. You then close the VISA ref making it un-usable for the rest of the Write/Read.

 

Maybe with the highlight on you get lucky and maybe get 2 or 3 Reads in before COM 7 is CLOSED making it un-usable for the rest of them. Causing all the rest to ERROR out.

 

Are you under the impression that because in your SEND case you have the "SECTOR", "ITEM", etc cases arranged from top to bottom that LabVIEW will run SECTOR first completely and then run "ITEM" and then the next so on from top to bottom? I sorry but LabVIEW will run them in parallel. It will run all 9 at the same time in parallel.

Omar
0 Kudos
Message 8 of 21
(4,485 Views)

PLEASE, PLEASE read the LabVIEW Help screen about "Race Conditions" before altenbach, RavensFan, and Omar_II each have a stroke! They have all warned you about running things in parallel, yet you have not changed a single thing in that regard. Do you understand what is meant by running processes in parallel and running processes sequentially?

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 9 of 21
(4,474 Views)

Re-Read the post from 

Omar
0 Kudos
Message 10 of 21
(4,472 Views)