03-27-2013 10:08 AM
I have a PXIe-1082 chassis containing a PXIe-8133 embedded controller. The controller runs on Windows 7 Professional.
Currently, I have a LabVIEW VI host on a Windows 7 Professional PC trying to communicate with a LabVIEW VI target running on the controller via TCP. However, whenever I stop the LabVIEW VI host, the LabVIEW VI target still executes. When I try to stop it, I got the attached warning related to TCP Read. How do I fix this warning?
Regards,
Chi
03-27-2013 07:42 PM
There are a few error values that can occur with the tcp functions that are expected under certain conditions. This most often happens when one side of the connection closes the connection, the other returns error status. You can set up a case structure to trap the expected errors and clear them instead of passing them out. Depending on how your code is structured you might see code 62, 64, or 66.
03-28-2013 08:34 AM
Thanks for your suggestion of using "Clear Errors.vi"!
Regards,
Chi
03-28-2013 09:01 AM
@cha@bellhelicopter.textron.com wrote:
Thanks for your suggestion of using "Clear Errors.vi"!
Regards,
Chi
The better solution is to use the exception features in the general error handler. Have a quick peek at this snippett and read the detailed help.
03-28-2013 09:45 AM
Hello Jeff,
Do I need a separate "General Error Handler.vi" for each error code 62, 64, and 66 ?
Regards,
Chi
03-28-2013 10:32 AM - last edited on 08-19-2024 02:12 PM by Content Cleaner
You might, and you'd also need to change the type of dialog so each error handler doesn't put up a dialog if it gets one of the other codes.
Take a look at the article "A Multi-client Server Design Pattern Using Simple TCP/IP Messaging" (https://forums.ni.com/t5/Reference-Design-Content/Multi-Client-Server-Application-Design-Pattern-usi...). The paper talks about STM which is another wrapper around TCP, but internally it is still using the same functions you are. Figure 4 shows a case structure configured to catch the errors and the paragraph just below the figure gives a high level explanation.
03-28-2013 12:06 PM
Hello DAD,
Besides the PXIe-8133 embedded controller in slot 1, my PXIe-1082 chassis also includes (5) 16-analog-input-channel PXIe-4496's in slots 2 through 6, a total of 80 accelerometer measurements. I read in 2 seconds of data for each accelerometer measurement sampled at 4096 Hz.
The LabVIEW VI running on the Windows-7-Professional PXIe-8133 has (2) WHILE LOOP's, one for relatively fast DAQ {producer loop} and the other {consumer loop} for slow computing Fast Fourier Transform (FFT) on all 80 measurements, performing limit checking and TDMS-formatted data logging, as well as displaying FFT results graphically in the frequency domain.
To prevent memory leaks, I use
(a) "queue" for data transferring from {producer loop} to {consumer loop}, as well as
(b) "semaphore" to make sure all FFT computations are finished before DAQ starts again {the sample mode of "DAQmx Timing.vi" is FINITE}, and
(c) only 6 FFT results are displayed graphically at a time
All TCP/IP examples so far suggest the implementation of (2) WHILE LOOP's, one for sending and the other for receving. My LabVIEW VI on a remote Windows-7-Professional PC
(1) sends a 1-byte (1 or 0) to the LabVIEW VI running on the Windows-7-Professional PXIe-8133 to turn (on or off) TDMS-formatted data logging if a threshold limit among 80 accelerometer measurements is violated
(2) receives a 1-byte (1 or 0) from the LabVIEW VI running on the Windows-7-Professional PXIe-8133 indicating whether or not an accelerometer measurement exceeds its threshold limit
Since I do not want to create more WHILE LOOP's, I implement "TCP Read.vi" in the DAQ {producer loop}, and "TCP Write.vi" in the FFT {consumer loop}. For inputs to "TCP Read.vi", I use 1 for "bytes to read" and 100 for "timeout ms" {the same for "TCP Write.vi"}. However, I notice the graphical display of FFT results slow down quite a bit.
From your experience, are "TCP Write.vi" and "TCP Read.vi" the culprits here? Should I implement (2) additional WHILE LOOP's for TCP/IP?
Regards,
Chi