LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to output binary data to VISA

i am interfacing labview with pic microcontroller through serial port using VISA. it is a stream of digital data which is being tranmitted ,stored in microcontroller and then retransmiited by microcontroller to other device...problem is when that data is converted to string to be given to VISA it makes 16bytes out of 16bits...for example if data was "11110000" (1byte) after converted to string it becomes 8 bytes and my microcontroller thibk that 8 bytes are coming................ please kindly tell me how to transmit binary data over serial port so that bit remains a bit dont become byte............................ data is 99bytes but after passing through VISA it become "99x16"bytes........ please help me
regards
umair
0 Kudos
Message 1 of 6
(3,578 Views)
It sounds like you are converting the numeric to a binary string with the wrong function. You don't mention how you are converting it but all you need to do is a type cast. If the numeric data is an array of U8, then you can use the Byte Array to String function.
 


Message Edited by Dennis Knutson on 08-10-2008 02:32 PM
Message 2 of 6
(3,576 Views)

actually i have string of data avilable which i am catenating into  array by "build array" function after converting them to 16bit integer word.i have attached the vi for your further kind assistance....when that function passes  through visa 16 bit integer(2 bytes ) become 16 bytes. please have a look. what i want is that after passing through VISA bit should remain a bit

0 Kudos
Message 3 of 6
(3,553 Views)
What you are doing is a bit confusing. I don't think you need any of that Boolean conversion stuff/division by data bits, etc. and you should not be using the Format Value function. That is what is causing your problem. You are converting some number to ASCII. Originally, you said you were sending a single byte. If you are sending 2 bytes, split them them and use one of the functions I mentioned above. Try taking the 3 I16, convert them into 6 U8, and send them all at once with the Byte Array to String. Six bytes in, six bytes out and written.
Message 4 of 6
(3,545 Views)

ok i got ypur point a little.................... let say that i have a number "32768"  .its binary conversion is "100000000" (2 bytes) whta i actually want is when i transmitt "32768" it get transmitted over RS-232 cable as two bytes............. just tell me how can i do that as simple as possible. i have applied one technique i have split number into two bytes (hi and lo)

then then i append high and low byte into array then i used byte array to string convertor ,let say for example hi byte was "65" and lower one ws "67"  after converting to string the corrosponding ASCII  were "A" and "C" and they get transmiited as sinle byte each .what i want is data to become binary version of 65 (which is"1000001") but still be transmitted as one byte and read as 1000001 on the hyperterminal of other PC through PIC microcontroller.i hope i have made my point clear .. i am working on my project which has a dead line soon i am stuck here i would be very tankfull if u can kindly farword me your e-mail ID for further assistance i would be very thankfull 2 you

0 Kudos
Message 5 of 6
(3,533 Views)

The attached example in 8.0 converts a U16 into two U8, builds an array and with the Byte Array to String, converts to the hex string 8000 (two bytes). Note that the string indicator is configured for Hex Display (right click option).

Now, when you say you want to see '1000001 on the hyperterminal of other PC', you are contradicting yourself. Hyperterminal cannot be set for binary display so if you want to see '10000001' in Hyperterminal, then you need 8 bytes (one for each ASCII character).

I hope I have made myself clear.

0 Kudos
Message 6 of 6
(3,503 Views)