LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read continous streams of data?


@Okor29 wrote:

Sorry I dont understand this comment could you please explain or is it that I wont need to wire anything? 

 

"The termination character by default is a linefeed character (0x0A hex), unless you wire a different character up to the "VISA Configure Serial Port" VI to change it to something else, which you don't need to do in this case"


You don't need to wire anything to the "termination character" input of "VISA Configure Serial Port" because the default value is already what you want, but you do need to wire a big number to the "byte count" input of "VISA Read" to make sure that the read ends when the termination character is received and no sooner.

0 Kudos
Message 31 of 46
(700 Views)

@JÞB wrote:

@arteitle

It was the comment //this library.. .with I2C devices.

 

Way under scoped unless you know that it means I2C gyros from a specific mfg.

 


It doesn't; it's referring to the Arduino I2C library called "Wire" which was being included on that line.

0 Kudos
Message 32 of 46
(698 Views)

It comes up ff

 

Do you mean 255 decimal?

I love it when the new school season starts. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 33 of 46
(686 Views)

If we are correct that you are getting multiple lines of text (which implies that the Arduino is issuing some "End-of-Line" paradigm, probably <CR><LF>, which the default VISA setting for LabVIEW will just love), your VISA routine can possibly be simplified to this:BS Bluetooth.png

Note I didn't make a Snippet, because (a) the OP is using LabVIEW 2014, so couldn't "paste" it and get code, (b) the code is dirt simple, and (c) see that Icon in the upper left corner?  I made it, myself.

 

Some comments:

  • The constant labeled "Bluetooth", if you click the little down arrow and your Bluetooth is connected, you should be able to "navigate" to it by its VISA name.
  • VISA Config uses all defaults except for Baud Rate, so leaving them off simplifies the Block Diagram.
  • I presume there is some command that you send to tell VISA to start listening.  You should only need to do this once (unless your VISA is weird).
  • Now you listen, waiting for a <LF> to be received in the next 10 seconds (your TimeOut).  When it arrives, you have the Latest Line (which you display) and add it to the growing All Lines string.
  • When you push Stop, you might want to tell VISA to stop before you close it.
  • Notice the use of the Error Line.  They should (almost) always be wired.
  • What if 10 seconds elapses before VISA sees anything?  Think about the Timeout and what it means.

My colleagues will probably point out something stupid that I overlooked, but this sort of VISA programming doesn't need to be complicated ...

 

Bob Schor

 

PS -- you may wonder where your large square icons for Controls and Indicators went.  I right-clicked them and turned off "Display as Icon".  Keep the Block Diagram Neat.

 

0 Kudos
Message 34 of 46
(683 Views)

Hi, thank you Bob once again. I have a few questions:

 

- the latest line and all lines found in strings, how do you connect it to the VISA read? 

- What is the icon called that connects the all lines string to the VISA read?

- What is the error with a speach bubble icon? 

0 Kudos
Message 35 of 46
(674 Views)

@Okor29 wrote:

- the latest line and all lines found in strings, how do you connect it to the VISA read?

 The output of VISA Read is a String of up to 1000 bytes, ending when the Termination Character (0x0A, by default) is read.  Since your data consists of lines of text produced by Arduino having probably <50 byte lines, this is a "short string".  "Latest Line" is an Indicator that is wired directly to this output, so each time Arduino sends data, the latest will appear here, updated as fast as Arduino sends you stuff.  This string is also appended ("concatenated") on the string held in the Shift Register, which accumulates all of the lines, but you don't see it until the Loop exits (beause of Data Flow) when it is written to All Lines.

- What is the icon called that connects the all lines string to the VISA read?

I'm uncertain whether you are referring to the Concatenate Strings function inside the loop, with two inputs and one output (that sticks two strings together) or the up-and-down triangle "not quite a Tunnel" on the edges of the While Loop, which is a Shift Register.  If you don't know about Shift Registers, you really must learn about them -- they serve to "remember" variables from iteration-to-iteration in While and For loops.  Unlike Local Variables, they are "anchored in space" (confined to a particular loop) and have other positive advantages.

- What is the error with a speach bubble icon?

That is the Simple Error Handler.  The Error Line isn't much use if you don't know an Error has occurred.  This function can be found on the Dialog Palette -- if an Error is present when it is called, it generally lets you know about it (also a Good Idea).  For sub-VIs, I tend to use Error In and Error Out, but for Stand-Alone Routines, it is neater (meaning "less messy") to use the SEH instead of plunking down an Error Out terminal on the Front Panel (you have to go look at it, while the SEH will "yell at you" if necessary). 


Good Questions.  Hope the answers make sense.

 

Bob Schor

0 Kudos
Message 36 of 46
(668 Views)

Hi Bob, thank you very much, explained the icons very well. I have set it all up now, but nothing is showng up on the front panel and I dont know why? Also I get an error at the VISA read stage? 

0 Kudos
Message 37 of 46
(657 Views)

Look at your Block Diagram.  There is probably an error on it that I can't see (because you didn't attach it!).  Attach the VI, which is much more helpful than a Picture (which I can't inspect, can't change, can't run, etc.)

 

And what is the specific VISA Error number (which is usually an Important Clue)?

 

Bob Schor

0 Kudos
Message 38 of 46
(653 Views)

Hi Bob, Please find attached block diagram. 

Error:

Error -1073807343 occurred at Property Node (arg 1) in VISA Configure Serial Port (Instr).vi->Bluetooth_V3.vi

 

0 Kudos
Message 39 of 46
(646 Views)

Sorry this is the initial error I saw:

 

Error -1073807339 occurred at VISA Read in Bluetooth_V3.vi

Possible reason(s):

VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.

 

The VISA configure serial port is working now 

0 Kudos
Message 40 of 46
(645 Views)