Jump to content

simple serial read [?]


h4med

Recommended Posts

Hello to masters of LabView

I am a new user of LabView and trying to establish a serial connection between LabView and a Microcontroller (ATMega16), in first step I just need a very simple data transfer, without any handshake and any driver, etc. just Micro read some analog value, convert it to digital, then via rs232 send to PC, and finally LabView display and analyse these bytes.

In terminals such as BASCOM and Proteus I receive bytes, but in LabView I have nothing.

How can I do that as simple as possible without any confusing VISA vi?

Link to comment

VISA is not confusing. Rather it makes all your communications (serial, gpib,...) equal in design.

From LV7 on there is no other possibility to make serial read/write than with VISA.

Go to Help\Find Examples... in your LV menu. There you will find tons of handy code-examples on how to proceed with the various tools of LV. Take the example for serial read, modify it so it to your app, and if it still doesn't work post it here, so we can check what's still wrong. This way you get most feedback, since it shows you tried and are not waiting that others to the job for you.

Also a good resource of help is The LabVIEW FAQ of this site and the LV-help (even after 8 years of LV-programming it can be handy to me).

Didier

EDIT: Too slow in tiping... ;)

Link to comment

Thank U khaild, but I couldn't open your file, because my LabView version is 7.0 (evaluation version) and yours is 7.1.1

I tested this file:

http://forums.ni.com/attachments/ni/170/153176/1/test41.vi

from here

http://www.codecomments.com/LabVIEW/message702981-1.html

but I took these strange error:

Error -1073807202 -> "This error code is undefined. No one has provided a description for this code, or you might have wired a number that is not an error code to the error code input."

I test all examples in examples/instr/smplserl.llb, I just get nothing or the above damn Error :headbang:

Link to comment
Error -1073807202 -> "This error code is undefined. No one has provided a description for this code, or you might have wired a number that is not an error code to the error code input."

In the NI knowledge base you find a lot about this error.

As you state that you are using eval version, did you installed VISA? You get it either from the NI site or on a CD called "Device Driver Reference CD".

If you installed NI-DAQ (With VISA, Measurement Explorer,...) you might need to run the Measurement Explorer at least once, so the ports get registered correctly by VISA. On earlier versions this was required, I don't remember exactly up to which version.

Link to comment
As you state that you are using eval version, did you installed VISA? You get it either from the NI site or on a CD called "Device Driver Reference CD".

Thank you for your fast responses didierj.

can you address me the exact URL of "NI-DAQ" for downloading, as I understand in my eval Version "Measurement & Automation Explorer" doesn't installed.

Link to comment
Thank you for your fast responses didierj.

can you address me the exact URL of "NI-DAQ" for downloading, as I understand in my eval Version "Measurement & Automation Explorer" doesn't installed.

EVAL version of LabVIEW may not have hardware support. But from your comments looks like you need to install VISA for the Serial port stuff to work at the very least.

Neville.

Link to comment

Long ago enough that I forget all about it, I wrote a serial port program in C that used visa calls for the serial port. Now I'm writing a labview serial port program, and it doesn't have all the functions I want. Specifically, I want the visa init to clear the serial port. I didn't see a function that would allow that. Apparently, the easiest way to do that is to open the serial port and then do a visa close, and then open the serial port again.

If I start and stop the serial port with the stop button on the window's toolbar, it doesn't clear the serial port, and my program doesn't work properly. I have it set up so that if you push my stop button, it does shut down the serial port which clears it. I'd hate to have to write a function to clear the serial port myself, it's just silly. Is there a way to trap the stop button on the toolbar, or disable it?

My experience with the HP visa was that it was much better at handling the serial port than I was with C.

Link to comment
If I start and stop the serial port with the stop button on the window's toolbar, it doesn't clear the serial port, and my program doesn't work properly. I have it set up so that if you push my stop button, it does shut down the serial port which clears it. I'd hate to have to write a function to clear the serial port myself, it's just silly. Is there a way to trap the stop button on the toolbar, or disable it?

Hi Eric,

You are not really meant to be using the "stop" button on the toolbar to stop your code. That is an ABORT button. Its like pulling the plug on your coffee-maker to stop it.

Write your code to exit/cleanup/close files etc. when the user presses a front panel boolean of your choice.

For your serial code, when user hits this STOP button, use VISA CLOSE to close the serial session, and free up the serial port for access again by either LabVIEW or another program (like Hyperterminal).

then you don't need your series of steps to have access to the serial port again in LV.

Hope this helps.

Neville.

Link to comment
  • 1 year later...

QUOTE(Neville D @ Dec 9 2005, 12:01 AM)

EVAL version of LabVIEW may not have hardware support. But from your comments looks like you need to install VISA for the Serial port stuff to work at the very least.

Neville.

Is the serial ports on the PC are included to this mentioned hardware support? Becuase I have installed Labview Eval v8.5 and I firstly wanted to try this property given above?...

When I keep on the example of basic serial read/write example, it gives the "VISA or a code library required by VISA couldnt be located or loaded. This is usually due to a required driver not being installed on the system. " error. Could this be related with the

NI-VISA Version 3.4.1 for RTX/Windows 2000/XP x64/XP--Includes LabVIEW RT Support?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.