LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP decode c++

Hi everybody,

I would like to write a TCP/IP where LabVIEW is the server and a c++-program is the client. I'm absolutely new to this stuff so I did some tutorials from NI. We only have LabVIEW version 7.1, so unfortunately I can't use the stm.vi's. Maybe someone can help me starting this project.
The idea is that the client sends a data package which includes 1 byte for the identification (e.g. if the following value is a value from velocity measurement or acceleration measurement), 8 byte for the value and 8 byte for the corresponding time value (for synchronization) and LabVIEW has to decode this and show it accordingly in the "velocity"-chart or "acceleration"-chart.
I thought of something like the meta data of the "A simple stm protocoll"-example but as I mentioned we can't use the stm and I'm not sure how exactly to create this array of clusters?

Maybe someone can help me, which would be awesome!
Thank you!

Steffi
0 Kudos
Message 1 of 39
(5,216 Views)
Here you have something for start.
0 Kudos
Message 2 of 39
(5,210 Views)


Message Edited by Eugen Graf on 01-15-2008 11:11 AM
Message 3 of 39
(5,209 Views)
And, yes, don't forget to set the timeout value for reading TCP/IP
0 Kudos
Message 4 of 39
(5,173 Views)
Ok, thank you very much for your help! I will have a closer look at it tomorrow.

Thanks!
Steffi
0 Kudos
Message 5 of 39
(5,160 Views)
You should also check out the TCP/IP examples that ship with LabVIEW. There's a client and server example in there.
0 Kudos
Message 6 of 39
(5,149 Views)
Hi Eugen,

I checked your VI today (the picture) and think that it is a good solution for my "problem"! Thanks a lot!
Unfortunately I can't open the VI itself because I have LabVIEW 7.1 and you generated it with version 8. But I don't know if this would have answered my questions anyway, so maybe I can ask you the following: 😞
I think you took the vi named "Array Subset" to distinguish between the velocitiy and acceleration (for the case-structure) and to have a subarray containing only the values for velocity or acceleration and time. Did I get that right? But "my" vi named "Array Subset" does only have one exit for the "subarray", so there is no exit left for the case structure to distinguish between the velocity and acceleration. I'm not really sure how you solved this, maybe you can give me a hint?
And I have another problem with the chart of the values:
I built two arrays (one for the time and one for the measurementvalues) and then I bundled them (is this procedure right?). If I create an indicator at the exit I get an output cluster, but I don't know how to transform this to a chart. If I first place a waveform chart at the frontpanel I can't wire it to the exit of the "bundle" vi. What is my mistake?

Thank you very much for your help!
Steffi
0 Kudos
Message 7 of 39
(5,127 Views)
The VI before Case is Delete From Array, which has two outputs: deleted element and remained elements.
I use XY Plot to show the Data over Timestamp.
 
P.S. here the same VI for 7.1


Message Edited by Eugen Graf on 01-17-2008 07:32 AM
0 Kudos
Message 8 of 39
(5,124 Views)
Aaah, ok. Thank you!
Shouldn't I wire the constant '8' to the length of the vi named "delete from array"? (As it is one byte for identification) And how can I define whether the byte contains identification for velocity or acceleration. Can I e.g. say if the first byte consists of eight '0s' then it's a velocity value and if it contains eight '1s' then it's an acceleration value? Where can I define it? Is it a good solution to take eight '0s' or '1s' or do you know a better way? (The c++ code will write another person and I have to tell him how to distinguish between the two cases)
You put nothing in your default case: I can put the acceleration case in it (in the same way as for the velocity case), or?

Thank you very much, I'm really sorry. I'm new to this.

0 Kudos
Message 9 of 39
(5,111 Views)
The example is not full, because I don't know how one package looks, do you have an example for one package?
 
You can define in the Case Structure (top of them) which byte is velocity and which is acceleration. Don't use the default case for acceleration, better is to add a new case (rightklick on case structure->add case after).
0 Kudos
Message 10 of 39
(5,108 Views)