摘要
为了解决在利用LabWindows/CVI编写程序控制仪器对串口进行测试过程中,采集数据时在程序收到串口信号前系统无响应的问题,对串口基本原理和LabWindows/CVI中多线程编程思想进行了分析,对用于测试的多线程编程方法进行了研究,编写了基于多线程的串口测试程序。程序中主线程用于程序界面的调用及程序的配置,次线程函数用于驱动串口读取数据,等待串口信号。经验证,基于多线程的编程方法在实际测试中有效地解决了超时问题,提高了测试程序的可操作性和易用性,达到了良好的测试效果。
In order to ravel out the irresponsive condition as waiting for data to be sent from the serial port when testing it, a multithread- ing-based testing programme for serial port is designed based on the principium of serial port and multithreading method in LabWin- dows/CVl, in which main thread starts and initializes the user interface while sub thread is used to wait and read the data sent from a seri- al port. This method solved the very problem in online testing and made the programme more maneuverable and easier to use,reaching the good effect.
出处
《计算机技术与发展》
2012年第7期121-123,127,共4页
Computer Technology and Development