Jump to content

Recommended Posts

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

Link to post
Share on other sites

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.

Link to post
Share on other sites

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

Link to post
Share on other sites
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.

Link to post
Share on other sites

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.

  • Similar Content

    • By ThomasGutzler
      Hi,
      I'm connecting to a Rigol DZ1000 Oscilloscope via USB and using the :DISP:DATA? ON,0,PNG command to grab a screenshot. Reading out the data in blocks of 65535 bytes until there is no more (see attached vi).
      This normally works fine but yesterday I was getting a timeout error. I fired up IO Trace and got this:
      > 783. viRead (USB0::0x1AB1::0x04CE::DS1ZA201305475::INSTR (0x00000001), "#9000045852‰PNG.......", 65536 (0x10000), 45864 (0xB328)) > Process ID: 0x000039C8 Thread ID: 0x00001760 > Start Time: 13:13:54.1169 Call Duration 00:00:10.4323 > Status: 0xBFFF0015 (VI_ERROR_TMO) You can see that 45864 bytes were received, which is exactly what was specified by the binary data header (45852 data bytes + 11 header bytes + 1 termination char)
      I dumped the reply string into a binary file and set the scope to run so it show something else on the screen. Sure enough the error went away. I also dumped a good result into a file. Then I tried to figure out what the problem may have been but I didn't get anywhere. Any ideas? Sure looks like a bug in VISA read or perhaps an incorrectly escaped reply from the scope?
      It's very easy to "convert" the reply into the screenshot - just remove the leading 15 bytes (4 bytes from WriteBinayFile and 11 bytes from the scope header). And yes, both data files display just fine as PNG. I don't think PNG does internal checksum so byte errors would be hard to spot.
      Any ideas what could have caused that timeout?

    • By govindsankarmr
      Hi, 
      I am looking for a paid or free course online for LabVIEW instrument control that covers topic like  communication protocols, RS232. GPIB etc. Can anyone suggest a good one. Thank You.
      Govind
    • By RMowatt
      I am experiencing numerous VISA Lock Errors (-1073807345) on resources I haven't explicitly locked.  This is happening on TCPIP connections to keysight N6700 power supplies and keysight N5242 PNA fairly regularly.
      I have simultaneous loops in the application communicating to the different instruments, using a sequencer of sorts to pipe commands one at a time to each of my various loops.
      Has anyone seen the locking error pop before while not actually using the Lock and Unlock VIs?  This issue has gotten worse lately and it has come time to find the root cause.  My only thoughts are that it may have something to do with having NI MAX and Keysight Connection Expert both installed and possibly trying to "ping" these devices.  Every once in a while me sending commands and these "pings" may clash and cause the locking error.
      Error reads as follows:
      "Specified type of lock cannot be obtained, or specified operation cannot be performed, because the resource is locked. VISA error code -1073807345 (0xBFFF000F)"
      We are using LabVIEW 2013
      Thanks in advance!
    • By Ricardo de Abreu
      Hi guys. This semester I'm starting a course system development for control and automation engineering, witch will be based on LabView. Therefore, my University doesn't have a NI hardware, even a MyRIO for us to test our VI and the teacher said that we should test our projects with our own Arduino...
      So, I have a little experience in Arduino and I know the basics for LabView. Now I'm in a point that I know that with Arduino I'll not take the best from LabView. I cannot even deploy a code to it.
      So, there is where my question comes in...
      I'm looking for a new board better then Arduino to use in the classes. I would buy a MyRIO card if I had the money but in Brazil this board is too expensive for me
       Witch one should I get that is closest to myRIO and less expensive than that? I would like to try de deployment of a VI and FPGA..... Is this possible?
      Thanks a lot for the help!
      Regards
    • By Benoit
      Hey guys,
      Can you take a look at this?
      The only work around I found is to dynamically open the connection with an external VI to make it fail so the second time it works.
      If anyone has an instrument that communicate trough TCP-IP with VI, please try on your side with LabVIEW 2018 and visa 18.
      https://forums.ni.com/t5/LabVIEW/VISA-error-with-TCP-IP-BK-precision-2190E/m-p/3876316
      Thanks
×
×
  • Create New...

Important Information

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