LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SetCOmTime

Hi Roberto,

I'm trying to install the callback, but I it seems to me that it is not possible to put in OR with LWRS_RXFLAG in the eventMask the timeout condition, set with SetComTime () after OpenComConfig().

Just because I need to be advised if I don't receive anything within the timeout.

Can you help me again?

0 Kudos
Message 11 of 13
(665 Views)

Yes, SetComTime will only work with variants of ComRd function and will not be fired in case of com callbacks. I suppose you can use a separate timer to handle the timeout event.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 12 of 13
(658 Views)

The best final solution I found was to implement MyComRdTerm, as follows:

 

static int MyComRdTerm (int portNumber, char buffer[], size_t count, int terminationByte)
{
   int rec_num = 0;
   unsigned char single = (unsigned char)(terminationByte+1);
   int i=0;

   while ((single !=terminationByte)&&(i<count))
   {
      rec_num = ComRd (portNumber, &single, 1); /* timeout is set after opening the serial com */
      if (rec_num == 1)
          buffer[i++] = single;
      else
      {
         i=0;
         single = (unsigned char)terminationByte;
      }
   }
   return i;
}

 

 

 

0 Kudos
Message 13 of 13
(654 Views)