LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communication with labview

Can anyone help me find the best way to send three bytes of data out through the serial port at 9600 baud? I've looked around a bit but I'm kinda confused....
0 Kudos
Message 1 of 11
(3,596 Views)
It seems like you asked the same question a long while ago. There is at least one shipping example on serial communication. Basically, you do a VISA Configure Serial Port and then a VISA Write. Both of these functions are on the Instrument I/O>Serial palette. What exactly are you confused about? If you need to transmit specific bytes instead of text, then define the bytes in an array of U8's, wire this to the Byte Array to String, and wire the output of this to the write buffer of VISA Write. If you continue to have problems, provide some more details and the code you've written.
0 Kudos
Message 2 of 11
(3,585 Views)
Look in the examples\inst folder for the smplserl.llb file. There are three examples.
0 Kudos
Message 3 of 11
(3,582 Views)
Well its like this. We're using VISA and we're trying to send a byte ranging from 0 to 255. unfortunately, setting a U8 numeric and then converting it to a string and sending that seems to be sending additional data other than just a start signal, the byte, and a close signal. Oddly, we are able to get the appropriate signal when we send an ASCII character of the corresponding value as a string without ever using a number. Unfortunately this does not work for many cases as lots of ASCII values over about 170 are untypable as are most before 33. Attempting to use alt and the number pad renders a | in all cases where the characters are nondisplayable. Is there a way to send just a byte using numerics? The only VISA output tool I've found so far only accepts a string as outputable data, and converting from a U8 to string is definitely not rendering the same string as the ASCII character equivalent.
0 Kudos
Message 4 of 11
(3,557 Views)
You're going to have to post an example displaying this behavior of additional data. If you look at the attached example (LabVIEW 7.1), the byte to string does the same thing as the string control. As far as using a string control/indicator to send/display the unprintable characters, you can easily do this be either setting the string control/indicator for either / Code or Hex display. 
0 Kudos
Message 5 of 11
(3,551 Views)
okay the example you posted didn't work cause I'm not using 7.1 Basically the problem is we're trying to convert a number from 0 to 255 into a string that we can send using VISA Write. The problem is the formatting of the string doesn't produce -just- an ASCII character. Its appending the format of the number (for example Unsigned 8 bit number) to the data and its attempting to pass this through visa write. For example, if we send " as a string, our test equipment tells us that 34 was sent. This is correct since " is position 34 on the ascii table. The problem arises when we try to use format into string to convert the U8 numeric with "34" entered into a string, and send it, something other than 34 is displayed. Generally an error because the test equipment is only set up to recieve 1 byte. So I guess the question is how do we convert a number into a string without having to worry about header information such as number format being included in our output.
0 Kudos
Message 6 of 11
(3,536 Views)
Do NOT use format into string. When you do that, all that you're doing is converting the numeric to the characters "3" and "4". I said to use Byte Array to String. If you have the numeric constant of decimal 52 which is hex 34, convert to an array, Byte Array to String, you will be sending the character 4. If you were to tell me your LabVIEW version, I could save it to that and repost the example.
0 Kudos
Message 7 of 11
(3,516 Views)

Here's Dennis' code in picture format.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 11
(3,508 Views)

Mike, a word to the "blind man" - Paint in XP has built-in the options to save an image as JPEG, GIF and PNG, thus reducing its size by large percentages -  usually around 90 to 99%.

BTW, did you know that The Lion, the Witch and the Wardrobe is scheduled to come out as a movie later in the year?


___________________
Try to take over the world!
0 Kudos
Message 9 of 11
(3,488 Views)
I did X3 I've known for well over a year actually XD *obsessive Narnia fan* 🙂 Thanks for the help guys 🙂 Looks Like I've got it workin now 🙂
0 Kudos
Message 10 of 11
(3,483 Views)