leonardovieira Posted June 21, 2010 Report Share Posted June 21, 2010 Hello i'm having a very basic doubt. I have a data to send in a 16bits size but like i' m sending it via serial port, so i can only transfer 8 bit each time. How can I concatenate these 2 parts of 8 bits and plot them in a chart? Is there a function that do this for me? Thanks . Quote Link to comment
crossrulz Posted June 21, 2010 Report Share Posted June 21, 2010 How can I concatenate these 2 parts of 8 bits and plot them in a chart? Is there a function that do this for me? Look in Numeric>>Data Manipulation to find Join Numbers and Split Number. Join Numbers will take two U8s and turn them into a U16. Split Number will do the opposite. If you are dealing with arrays of your 16bit data, you may want to also look at the Decimate 1D Array and Interleave 1D Arrays. Quote Link to comment
leonardovieira Posted June 21, 2010 Author Report Share Posted June 21, 2010 (edited) Look in Numeric>>Data Manipulation to find Join Numbers and Split Number. Join Numbers will take two U8s and turn them into a U16. Split Number will do the opposite. If you are dealing with arrays of your 16bit data, you may want to also look at the Decimate 1D Array and Interleave 1D Arrays. Thanks for the answer Croos rulzs, but i how i will I able to "save my first incoming 8 bits from serial port . My full problem is that a DSP is sending a 16 bit data information ( its send fist the MSB to the LSB), but i'm using a serial port which transfer 8 bits at time. How will I be able to save the first 8 bits ( first part of data) and after that join this number with the second part of data , using the function JOIN NUMBERS which you spoke of.. Thanks. Edited June 21, 2010 by leonardovieira Quote Link to comment
TG Posted June 23, 2010 Report Share Posted June 23, 2010 Look at Croos rulz diagram again and you will see that all you need to do is make 2 unsigned 8 bit numbers from the serial data you are getting from the instrument. Use the string conversion functions to convert your string representation into a numeric one. Once you have both numbers available plug em into the Solution shown above (with some minor modifications of course) As to the actual serial communications part I can't answer that because there is not enough information. Quote Link to comment
leonardovieira Posted June 23, 2010 Author Report Share Posted June 23, 2010 Aquisição 16 bits with error.viAquisição 16 bits sem case.viTG and CROSS thanks for the help. I'm very new and labview so i'm having my dificulties. I'm ataching to of my VI's first of them uses only one part of the Cross Rulz diagram. But if I use teh full of Cross Rulz diagram it doeesnt work because the type of data is diferente. Look. It seem to be a very easy thing to do and I'm complicating it. If you may help me. What I'm doing wrong? Aquisição 16 bits sem case.vi Thank you guys. Quote Link to comment
Jon Kokott Posted June 23, 2010 Report Share Posted June 23, 2010 Look in Numeric>>Data Manipulation to find Join Numbers and Split Number. Join Numbers will take two U8s and turn them into a U16. Split Number will do the opposite. If you are dealing with arrays of your 16bit data, you may want to also look at the Decimate 1D Array and Interleave 1D Arrays. The type cast function is a much cleaner way to do this. I suspect significantly faster as well. ~Jon Quote Link to comment
leonardovieira Posted June 23, 2010 Author Report Share Posted June 23, 2010 The type cast function is a much cleaner way to do this. I suspect significantly faster as well. ~Jon Jon How can I use type cast in this case? Quote Link to comment
TG Posted June 24, 2010 Report Share Posted June 24, 2010 Sorry I do not have code capture tool installed properly yet. SHame on me. Why not first get the complete response from the instrument then you can make some code to test for proper conversion of the strings without having to worry doing it all at once so soon. Look for any termination character or if you know for sure that it is exactly 8 bytes at a time then get the entire response in 2 stages and get the two 8 byte response strings. Once you have the exact response then you can figure out how to convert it to unsigned integer etc.. Make sure instrument is not sending extra termination character or filter it out with string function to remove whitespace. Look at the two strings the instrument returns then work from them (off line so to speak) until you can get the string converted properly to the unsigned integer You can use LabVIEWS display utiliy to see exactly what the instrument returns. (Right click on string ind and select '\' codes display so that you can see all the characters that are returned from the instrument. This way you know exactly what you are working with. Quote Link to comment
leonardovieira Posted June 30, 2010 Author Report Share Posted June 30, 2010 Sorry I do not have code capture tool installed properly yet. SHame on me. Why not first get the complete response from the instrument then you can make some code to test for proper conversion of the strings without having to worry doing it all at once so soon. Look for any termination character or if you know for sure that it is exactly 8 bytes at a time then get the entire response in 2 stages and get the two 8 byte response strings. Once you have the exact response then you can figure out how to convert it to unsigned integer etc.. Make sure instrument is not sending extra termination character or filter it out with string function to remove whitespace. Look at the two strings the instrument returns then work from them (off line so to speak) until you can get the string converted properly to the unsigned integer You can use LabVIEWS display utiliy to see exactly what the instrument returns. (Right click on string ind and select '\' codes display so that you can see all the characters that are returned from the instrument. This way you know exactly what you are working with. Guys Thanks for all the answers. I've managed to convet the signall. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.