Another problem is the server program use the CPU too much.
The server program is to sample data from two same instruments. Every instrument have a RS232. So the original RS232 interface in the pC is not enough . I use the MOXA Nport 5610-8 series server to expand the rs232.
Every instrument have 6 channel . The sample program is to sample data from 12 channel and save and display them.The sample period is 1 second.
The communication between PC and instrument have 4 steps.
Step1 PC send 5 letters to instrument
step2 instrument reply 3 letters to PC
step3 PC send 1 letter to instrumnet
step4 instrument send 12 letters to PC
I will check return value of code (status=RdCom(); ) in step2 and step4. And I will check the replied letter in step2 and step4 one by one. If the replied letters are the right information, my sample program will save the data and do the alarm check(if data is more/less than the alarm value). Then share the data by means of string using DataSocket server.
The task is so simple and the code is not many. But the sample program makes use of CPU at 95% almost. The configuration of my pc is : P4 2.4, 512M rambus memory XP+sp2) My cvi verson is 8.0
What is the reason for the heavily using CPU?
Now I have to reduce the channels to 6 .The using rate of CPU changes to 50% almost.
帖子被lct0811在
02-24-2008 12:49 AM时编辑过了