A few months ago I did the LabVIEW Connectivity course at National Instruments UK. I really enjoyed it but haven’t got around to trying any of the concepts out yet. Last week I decided to write a TCP/IP chat program working between LabVIEW running on my Windows laptop and Python running my Raspberry Pi.
I ended up using two threads. One for the transmit and the other for the receive controls.I used a global variable which is used to stop the threads when the client or server is stopped. I also needed to use a timeout in both the transmit and receive thread because the recv() and readline() methods blocked the program flow which locked up the threads if the client was stopped.With the timeout set, I could monitor the global variable and return cleanly from the thread when the client or server was stopped.
First start the LabVIEW server, then within 60 sec run the Python client. The connection will be established and you will be able to send strings between LabVIEW and the Raspberry Pi. To stop the programs, either use the Stop button in LabVIEW or CTRL+C in Python. Both methods will stop both the server and the client.
For more detail: LabVIEW and Raspberry Pi TCP/IP Communications
Current Project / Post can also be found using:
- interfacing raspberry using labview by tcp/ip
- Lab 5A - TCP and UDP Communications