LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Multithread and COMCallback

Hi ! I've written a program that receives datas from serial port and plot them in a strip chart. The problem is that if too data reaches the pc, the program freezes and dies. I thought to put the ComCallback in another thread and plot blocks of datas for example 5 times per second. But how can I make the COMCallback run inside another thread ??
Thank you !!
0 Kudos
Message 1 of 4
(3,435 Views)
Hi Max,

the best documentation you can get to learn how to implement Multithreading in CVI is located in this folder on your computer
...\Program Files\National Instruments\MeasurementStudio\CVI\bin
and it is called MultithreadingOverview.PDF.

This document include some neat examples for your needings.
If this answer is not fully going to solve your problems, consider also posting an e-mail message on the web at
http://www.ni.com/ask

or consider calling our Technical Support service to get in touch with one of us. The phone number is 02.41309217.

Ciao

A. Deotto
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,435 Views)
Hello

That docuement is an excellant reference, especially if its the first time you are using CVI with multithreading.

You can also look into using the PostDeferredCallToThread() function inside the callback. allows you to run functions in seperate threads and its really simple to setup. All you need is a thread that stays alive during the process and calls ProcessSystemEvents ( refer to the docuementation for PostDeferredCallToThread() ), and with the thread ID, you can basically tell CVI to call your custom function after the COM callback is called. SO the COM callback will still run in the UI thread, but now you can "defer" the processing inside the callback to run in another thread.

I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 3 of 4
(3,435 Views)

Hello 

me too I have a problem with that kind of application. I use multithreading communication between my evalboard (stm32F4) and NIcvi (my PC equipped with  corei3 processors ) I am not using a high baud rate (9600) but the communication is always faster than the cvi code execution. I wonder, if there is someone who can help me in improving execution time and thinks in advance. (the code is not complicated I have just to verify a checksum of every received packet ).

 

0 Kudos
Message 4 of 4
(2,656 Views)