LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem to read serial port data, from pic 16f877.... any help!

Hi Fonsi,

let me answer your question:

1) The best way to indicate your program the number of bits to read is through the VISA Read. You have an input called "byte count", there, you have to type the number of BYTES to read, for your application would be 6 bytes (3 pairs of 2 bytes). Moreover, with the "VISA Set Timeout" (Functions|All Functios|Instruments I/O|VISA|VISA Advanced), you can indicate the time that in this case your VISA Read will wait for the bytes to arrive before continuing.


2) About the second question, you would be able to do through several methods, one of this method is the VI that you can find in this reply ("String to Array.vi"). Basically, when you have your data within the string, you have to split them in three group of two bytes (at the ending you´re going to have three strings, "First string", "Second string", "Third string"), this step is done with the " String subset" function.

Then, with each string and using the "type cast" function you´ll convert your string to the right numeric representation (I32, I16, etc..). Your application would be able to end here, but this will depend how your instrument send the comand sequences; if you have to swap the bytes of each array you woud use the "Swap bytes" function, etc..


Anyway, first you will have to think: - Your arrays will be with either signed or un-signed ?, - How does your instruments send your data?Then you have to use the advanced vis to manage the bytes to get the real numeric values you expect.

Note: One advise: It would be great if you may use the help of labview (for VISA vis, string and array functions,...) in order to know more of the LabVIEW´s philosophy.

I hope this help you.

Regards

Diego M.
Message 11 of 12
(1,133 Views)
Thanks Diego,

I got improved my application in this vi, its current status.
http://forums.ni.com/ni/board/message?board.id=170&message.id=112525&page=3
regards and thanks for the help!.
0 Kudos
Message 12 of 12
(1,126 Views)