shmb Posted August 24, 2012 Report Share Posted August 24, 2012 (edited) labview.vi Hello everyone, I am getting data from serial port RS232 through Labview with my laptop . baudrate is 38400 and there is about 4080 byte every 5 ms (transmission rate). I am going to extract some specific bytes from each word (11 bytes in every word). I have to first convert the ASCII format of data to decimal and then extract some special bytes to get the waveform. So far I have converted the ASCII string to byte array and then convert byte array to decimal by using type cast function without yet extracting those two desired bytes. (Because I didn't find the right function yet) My question is that after getting data, when I am going to do conversions, program speed will decrease and it takes long time to do theses conversions after each transmission. I mean the waveform progress very slow. I am thinking about using Mathscript after reading from serial port to increase speed and being able to do conversion. I have attached the program. I am wondering if you could let me know whether I am doing right. Regards, Edited August 24, 2012 by shmb Quote Link to comment
asbo Posted August 24, 2012 Report Share Posted August 24, 2012 I don't understand what you're trying to do with the typecast. It looks like the effective result is just indexing the zeroth element. If that's what you want, you should use the Index Array node instead. If you know the offset of the byte(s) you're interested in, you can use the Index Array node to extract those as well. In general, it is extremely rare that Type Cast is the correct operation to be using in LabVIEW. You're writing to a chart, which retains all of the point written to it in a buffer up to a specific limit (1024 by default). Is it possible that your computer is not powerful enough to handle that? It would have to be a pretty old PC to struggle with that. Is it possible that the device feedback is slowing down? Further, you do not need to configure and close the VISA session on every loop iteration. Configure the port before the loop, pass the refnum in, and close it after the loop. Quote Link to comment
Ton Plomp Posted August 25, 2012 Report Share Posted August 25, 2012 asbo is ritght, initializing the serial port on every run is going to ruin speed on your VI. For the parsing, which eleven bytes do you need? (and a word is generally 2 bytes, so you cannot get 11 bytes from that). Create a VI that takes an example set of 4080 bytes that outputs your wanted data. Ton 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.