01-31-2019 08:52 AM
This VI does what it is supposed to do in design mode ( Its part of a project ). But when I build the project it does not work. The Serial Port reference is via the control which has the right port by default.
What could be wrong ? Using LV2017 / WIN10 Pro / VISA driver 17
Solved! Go to Solution.
01-31-2019 08:56 AM - edited 01-31-2019 08:58 AM
Hi Raghunathan,
don't use BytesAtPort!
As you enabled the TermChar (at SerialPortInit) all you need to wire is a sufficient large number of bytes you expect to receive…
There's no (real) error handling in your VI: do you get any errors when running the executable?
01-31-2019 09:48 AM - edited 01-31-2019 09:50 AM
Ohhh MogaRaghu,
You've been on the forums long enough to know that code is a bad idea.
I'm sure you've hear of not using Bytes at Port.
I'm sure you realize that having the false wired to the stop terminal makes it an infinite stop loop, forces you to abort the VI, and means the VISA close never runs.
And I'm sure you've heard that saying something "doesn't work" isn't helpful. Explaining in what ways it doesn't work is.
Please tell me what you based your code off of. I'm guessing it is the Simple Serial example which while simple, is a really poor example of how serial based communication works.
Everyday we see bad examples of serial port communication all with the same flaws. It is like a virus. I wish we could the source of it all and get rid of it.
You are saying you are building this into and exe, correct? Are you running it on the same PC as your development environment?
01-31-2019 10:03 AM
I did mention this code snippet is part of a large project where the stop signal is generated based on human interaction. I just simplified it here to make it simple. And so that explains the False constant wired to Stop.
You wanted to know what the code is based off. Frankly it was copied from another of (my) project. And that's working the last year onwards.
Bytes at port … ok maybe it is evil as death. Will not use it.
What works in design does not work when I build the App. That's what I wanted to know why.
01-31-2019 10:08 AM - edited 01-31-2019 10:10 AM
@RavensFan wrote:
Everyday we see bad examples of serial port communication all with the same flaws. It is like a virus. I wish we could the source of it all and get rid of it.
Well the source of it is LabVIEW itself
Go to Help--->Find Examples
Then search for Serial and open the "Simple Serial" example
We all need to lobby NI to replace this example with one that uses proper serial programing techniques.
01-31-2019 10:20 AM - edited 01-31-2019 10:22 AM
@RTSLVU wrote:
@RavensFan wrote:
Everyday we see bad examples of serial port communication all with the same flaws. It is like a virus. I wish we could the source of it all and get rid of it.
Well the source of it is LabVIEW itself
Go to Help--->Find Examples
Then search for Serial and open the "Simple Serial" example
We all need to lobby NI to replace this example with one that uses proper serial programing techniques.
I knew that and said that in my message. I just wanted to hear directly from the people using Bytes at Port where they are getting the idea from. Unfortunately, that is so pervasive that even fixing the example won't eradicate all the sources of bad information out there that used it. I really wish NI would kill this example.
So MogaRaghu, you still haven't answered our questions.
What error are you getting when it "doesn't work"?
Are you running the executable on the same PC you developed on?
01-31-2019 10:23 AM
Not likely to be your problem, but your VISA Configure is set to use LF (\n) as termination character, yet your command is terminated with a CR (\r). Is that really what you want?
01-31-2019 10:24 AM
@Mancho00 wrote:
Not likely to be your problem, but your VISA Configure is set to use LF (\n) as termination character, yet your command is terminated with a CR (\r). Is that really what you want?
I think that would be a problem, but it should cause a problem in the development environment as well as executable.
01-31-2019 10:30 AM
@RavensFan wrote:I knew that and said that in my message. I just wanted to hear directly from the people using Bytes at Port where they are getting the idea from. Unfortunately, that is so pervasive that even fixing the example won't eradicate all the sources of bad information out there that used it. I really wish NI would kill this example.
It really should be replaced with 4 to 6 new examples, each based on how the instrument communicates (Stream, Command-Response, or Intermittent transmission and ASCII or Binary/Hex/Raw data). And only the Intermittent versions should have the Bytes At Port in it.
01-31-2019 10:30 AM
@RavensFan wrote:
I think that would be a problem, but it should cause a problem in the development environment as well as executable.
That's what I thought. Sometimes things manage to work despite our best effort to mess them up, though. I've had to deal with engineers managing to get CRLF backwords (LFCR?). That was fun!