LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA driver for Serial Connection

Solved!
Go to solution

There is nothing obviously wrong with your VI.  It is pretty basic.

 

We can't comment on your Write string because it is saved as an empty string control in your VI.  When you type in your command to the control, do you need to include a termination character like a carriage return or line feed?  When it works in Hyperterminal are you hitting the enter key?

0 Kudos
Message 11 of 20
(1,747 Views)

Hi Csimpson.

 

I think the problem is caused, since you both are using VISA Open and VISA Configure Serial Port. You can only use one of them.

 

We have a NI Example that shows how to read and write using a serial connection. Navigate to Help => Find Examples, and search for "Basic Serial Write and Read.vi". This will show you how to use the VISA Configure Serial Port.

 

I hope this information is helpful.

 

Have a great day.

 

Best Regards

Alex E. Munkhaus
Certified LabVIEW Developer (CLD)
System Engineer
0 Kudos
Message 12 of 20
(1,740 Views)

@A.E.P wrote:

Hi Csimpson.

 

I think the problem is caused, since you both are using VISA Open and VISA Configure Serial Port. You can only use one of them.

 

We have a NI Example that shows how to read and write using a serial connection. Navigate to Help => Find Examples, and search for "Basic Serial Write and Read.vi". This will show you how to use the VISA Configure Serial Port.

 

I hope this information is helpful.

 

Have a great day.

 


That's simply not true. There is no problem at all in using a VISA Open. It is not required since VISA will automatically create a session but it will not cause any problems if you explicitly call it.

 

I think Ravens Fan is correct. You probably are not sending a termination character. Even if you enter a \r or \n, it will not be sent correctly since the string control is not set for '\' Codes Display.

Message 13 of 20
(1,724 Views)

Thanks Dennis,

I believe you may be correct. I had to create Termination character settings when I put set up NSTRUCT. How/where do I put in termination characters into my code?

0 Kudos
Message 14 of 20
(1,707 Views)

And yes, in HyperTerminal, I do use the enter key. But I had configured termination character settings with HyperTerminal prior to using it. I just can't find where to do so in LabView.

0 Kudos
Message 15 of 20
(1,706 Views)

Right click on your string constant and get it to display \codes.

 

If you want it to be a carriage return, then type \r.  If you want the line feed character, type \n.

 

DO NOT DO THIS WITH THE CONSTANT IN NORMAL DISPLAY.  If you do, then you wind up sending a literal backslash character and a literal character "r" or "n".

 

 

Message 16 of 20
(1,702 Views)
Solution
Accepted by topic author csimpson

I generally format my commend strings explicitly. If you need  termination character I include it in the command string itself. You could also set the end mode for writes using the VISA properties.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 17 of 20
(1,701 Views)

It works great!... THANK YOU SO MUCH. I never would have figured all of that out myself.

0 Kudos
Message 18 of 20
(1,679 Views)

Just jumping into the bandwagon of VISA configure vs VISA open. Like it has been pointed out, I never used VISA OPEN vi (actually never knew it existed because I always referred to the Serial palette 🙂 ) But, there was a weird error I noticed today in that my device said "Communication error" which pointed to either the resource was not open properly or something else went wrong. (My application has to run 24 hours 7 days a week) . But now, I have VISA configure followed by VISA OPEN before entering the While loop. Any preference in order VISA Configure --> VISA open or VISA open --> VISA configure or it doesn't matter?

 

Thanks!

I may not be perfect, but I'm all I got!
0 Kudos
Message 19 of 20
(1,649 Views)

@VeeJay wrote:

But now, I have VISA configure followed by VISA OPEN before entering the While loop. Any preference in order VISA Configure --> VISA open or VISA open --> VISA configure or it doesn't matter?


I would Open and then Configure.  That way you know for sure what you have.  I wouldn't want to risk the Open unknowingly change a setting on me.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 20 of 20
(1,638 Views)