Jump to content

Arduino RS232 Interfacing


Recommended Posts

Posted

Hi everyone,

 

New on this site, new to Labview, new to RS232 and actually new to pretty much everything!

Hope I'm not posting in the wrong section... I feel a bit out of place anyway to be posting among experts but well, for lack of a better place...

 

So here's the context of my problems : 

 

I'm trying to set up a (crude) acquisition system based on an arduino and a couple of multiplexers / Thermocouple conditionners.

My arduino is sending via its own USB-RS232 converter a string of all the values (approx. 20) as characters.

 

I figured out I could use Labview to do a nice displaying and logging of these values.

 

Now, I identified and downloaded VISA to communicate via RS232.

 

 

OK so, in the MAX explorer, I have under port & peripherals the VISA test panel and if I try the viReadtofile under Basic I/O, it gives me a nice file with one set of values (one line). So it does communicate ! YAY!!!

 

Onto the next part... I used a template from Labview, continuous datalogging and I just put the read to file VI but now when I press the RUN button, it gives me the two following errors.

 

 

Error 1 occurred at Property Node (arg 1) in VISA Configure Serial Port (Instr).vi->Test_Read_VISA_1.vi
 
Error -1073807346 occurred at VISA Read To File in Test_Read_VISA_1.vi
 
Why is it already blocking my progress?  ;)
 
And after that, I'm not sure I understand how can I process the output of the reading of the serial (basically, slicing the string of characters in it's values and displaying and logging them)? All the VI seem to directly process the serial readings to one thing without the opportunity for me to do anything to it...
 
 
 
I'm attaching my VI even though it's pretty much only the read to file VI...
I'm even ashamed to be that bad but I hope you guys will find enough faith in Labview to teach the basics to a newb like me! :)
 
 
Thanks by advance! :)
 
 
Marc

Test_Read_VISA_1.vi

Posted

You haven't told the Configure Serial Port which resource to use. Right click on the top left corner terminal and create a constant. Then select your serial port from the list.

Put the serial port initialise outside the loop (and don't forget to close it when the loop stops)

 

You should get it working with the Serial port examples first. Then you will see how to use the VIs correctly.

Posted

Hi guys,

 

Thanks for the answers!

 

 

You haven't told the Configure Serial Port which resource to use. Right click on the top left corner terminal and create a constant. Then select your serial port from the list.

Put the serial port initialise outside the loop (and don't forget to close it when the loop stops)

 

Ok, I thought that telling it which one by double-clicking and then setting it up inside the VI would be enough but I guess not...

 

Just one thing, when you say don't forget to close it when the loop stops? Do you mean the Configure serial Port VI? So I should put it outside the loop? Or just the constant?

 

 

Oh and as for LIFA, I'm seriously considering it but since I already have my code written (I'm not good enough to translate in Labview quickly...).

 

 

Thanks!

 

 

Marc

Posted
Ok, I thought that telling it which one by double-clicking and then setting it up inside the VI would be enough but I guess not...

 

Just one thing, when you say don't forget to close it when the loop stops? Do you mean the Configure serial Port VI? So I should put it outside the loop? Or just the constant?

I usually recommend looking at one of the shipped examples.  Search for Basic Serial Write and Read.vi in the Help >> Find Examples in LabVIEW.  This VI shows how to setup a port with the baud rate, and other bit flow settings.  Then  you write a string, wait, then read the response from the serial buffer.  If you have it working in MAX then it should work in here as well.

 

Oh and as for LIFA, I'm seriously considering it but since I already have my code written 

I would normally recommend LIFA but if you already have the code the way you want then I can see why you might want to stick with it.  For future projects you might want to try out LIFA.  It basically does what you already did for many I/O.  It has a base firmware you put on the Arduino, and then you have premade VIs that know what commands to write and read to get the response from the Arduino.

Posted

LIFA is a good starting point. It's worth looking at. It's a good reference for fixed-length binary serial packets. Make sure the checksum resets, though.

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.