08-24-2018 03:59 PM
@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.
08-24-2018 04:05 PM
08-24-2018 07:21 PM
It comes up ff
Do you mean 255 decimal?
I love it when the new school season starts.
08-24-2018 09:01 PM
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:
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:
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.
08-25-2018 12:58 PM
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?
08-25-2018 01:23 PM
@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
08-26-2018 09:32 AM
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?
08-26-2018 10:52 AM - edited 08-26-2018 10:54 AM
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
08-26-2018 11:47 AM
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
08-26-2018 11:56 AM
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