LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 communication separate batch of commands

   Hi!
  
   I have a device which sends more than 20 parameters through the r232 interface to pc.
   I have a set of commands in an array and i sent them to the device one by one.
   I recevied serious of response from the device and i displayed them in the PC.
   Now my probelm is, after a certain time stamp(4 or 5 min) device sends only the RS/RG commands back, not the
   real response.Device is configured to reset the output data's for every 10 min.
   As for as i tested with the device and TCL/TK data aquisition software,
   I could make sure that i have no problem in the timer. For the same baudrate,
   intervel and delay, device responce is appropriate and it meets the expected result/response.
 
   I have one more problem,
 
  Insteed of sending the batch of commands, i tried to split them into several arrays. But i have no mechanism to
  jump immediately from one set of array to antoher set of array of RS/RG commands.
 
  From the code which i have attached with this message,
 
  At Line number 1070,
  I send the first set of array  and i revecie the responce from the device.
 
   At line number 960,
 
   based on the command button, it should be cabale to shit the ´
 
   CMD_array1 or CMD_Array2.
 
   But i always have problem, even i clicked the different command buttons, i could't shift immediately from one array to another.
 
   It is a crucial problem for me pls help me......
 
 
 
     
 
0 Kudos
Message 1 of 4
(3,458 Views)
hello monky,

could you narrow down the problem description a bit.
from the lines you quoted i cannot see, what the problem might be. it seems that there are many empty call backs.

kind regards,

robert h
ni germany
0 Kudos
Message 2 of 4
(3,401 Views)

 well. yyah..! it is my mistake in line number.
 
 Now,
 In the line number 1145, I wrote in the comport
 
  like,,,
  CMD_Array[]={
                   
                   "RS_Password 0\r\n",
                   "RG_AirTemp1\r\n",
                   "RG_AirTemp2\r\n",
                   "RG_RelHumid1\r\n",
                   "RG_RelHumid2\r\n",
                   "\x01\r\n"
                    };  

 In line number 1125, I wrote the another array of RS/RG commands,

  like...
  CMD_Array1[]={
                     "RS_Password 0\r\n",
                     "RG_FanRPM\r\n",
                     "\x01\r\n"
                    
                  };
 
  Assume that i get the responces for the first array 'CMD_array' from the device..
  During this process, Sometimes i need to stop the CMD_Array of commands and i have to send the
  'CMD_Array1' and i have to receive the respose from the device.
  but, my problem is, i could't immediately shift from the CMD_Array to CMD_Array1. When motor_flag==2,
  I have to send the RG_FanRPM to the device. but i saw that my code is sending still 'CMD_Array' (RG_AirTemp1,RG_AirTemp2)
  It is a crucial problem in my work..please help me..
Thank you in advance,
 
 
0 Kudos
Message 3 of 4
(3,395 Views)
hello monky,

maybe you should insert a "FlushOutQ (1);" to clear
the outputbuffer if the comport.

regards,

robert h
0 Kudos
Message 4 of 4
(3,286 Views)