07-06-2010 11:21 AM
Several issues:
07-07-2010 01:57 AM
thank you for you intention
but i have put the while loop ,i want to plot the sine wave after reading immedialtly and the data is string so i will not plot string so i convert it to integer to have the same shape of sine wave .do you have any solutions else.
07-07-2010 09:04 AM
You're not really understanding what I'm saying. Perhaps it's a language issue. Yes, you have a loop, but you have it over the entire code. That's not correct. You do not want to reinitialize the port every time. That could clear your buffer. Again, did you look at the Advanced Serial Write and Read example? This is the third time I've asked this.
Also, why are you converting it to an integer? Is this what was generated? You had mentioned in your original thread that you're sampling the waveform. OK, so are the samples floating point values, or scaled values (which would be integers). You have to convert the data you receive based on what you sent. If you sent a floating point number then you don't want to convert it to an integer on the receiving side. That would make no sense, since you'd lose data. If you're scaling the value at the source, then you also have to scale it at the receiving end.
I will try to put together an example later this morning.
07-07-2010 09:19 AM
Attached is an example (LV 8.2) that monitors the serial port for data. It converts data in 4-byte multiples, as that seemed to be what you were implying. You did not indicate whether your source data is being sent as a floating point number or an integer or if it's scaled, so the conversion uses the SGL data type. If your source data type is different, then you will need to modify the number of bytes, and the data type of the array fed to the Type Cast function. See how far this gets you.
07-07-2010 11:50 PM
please i am not professional all what i did that i convert data from analog to digital and send it as byte
that's all
whan i try to plot it it didnot give me any thing ,because serial read it as string and i want to plot it as numbers i used array and type cast and it give me shape is quite close to origin
07-09-2010 05:27 PM
when i tried the advanced example it give the same shape when i change number of bytes to read
but problem is still exist because when i change the frequncey of analog signal it want to change number of bytes to read and i told that my signal contain more than one frequncey,so do we have solution for this problem
07-09-2010 05:47 PM
Did you look at the example I posted? You've still only provided half the information. For instance, what is the datatype at the source? How is it being converted to a string? Do you have the code for the source?
07-10-2010 12:50 PM
yes i looked in your example i didnot go as i want it ,i send data as bytes
which code do you mean ,some body asked before ,i sent the program for microcontroller and he was very angry
as he said this is labview forum
07-10-2010 04:43 PM
(Again, another reason to keep it one one thread.) Link to the basic code.
It looks like that code is writing out a series of bytes followed by a carriage return and linefeed.
So it would be a good idea to set your VISA port to enable the termination character and to be a linefeed character. Now read a sufficiently larger number of bytes, and you will get the whole message once the linefeed is read. Then you can strip off the last two characters of the received string.
Now the mystery is, what is the function WordToStrWithZeros(temp_res, output) ' Convert result to string doing? How is it taking your data and converting it to bytes? Once you know how it does that, then you can figure out how to convert those bytes back into to data.
I am going to guess that it isn't sending data in raw binary format. Let's say where a double floating point number (8 bytes) is not typecast to a string of 8 bytes. But it is probably being converted to a human readable series of ASCII formatted characters. Why? Because if a typecast of just the right number winds up with a hex0A byte (10 decimal or a linefeed character), how would you ever know that that byte is a part of a piece of binary data, as opposed to a termination character.
Why don't you post an example of the bytes being received in LabVIEW? I don't think I have seen that yet in any of your posts. It is kind of hard to help you decode any data when you don't provide the data that you are receiving, and tell us what you expect that data to say.
07-11-2010 01:17 AM
word to string convert the output of conversion to string
i used a nother simple program send the result as bytes