LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

data transfer and monitoring

Hi..!
  I use the following example which is suggested a month back from the developers, To transfer the data from one comport to the another comport via a null modem cable.I use the serial port monitor to monitor the data which are all comes in the receiving port.I could able to see the data's using the CVI printf / CVI Debugprintf. But i am unable to see those datas when i monitor using the serial port monitors..Why is that happing like that..any ideas....
 
Here is the link for hhd..
 
 
Thanx and regards,
venki
 
0 Kudos
Message 1 of 7
(3,964 Views)

Venki, I noticed in your code that you have bypassed the output buffer while opening the serial ports: this could result in the serial port monitor to miss all outgoing messages if it's what it is doing is really monitoring the buffers of the two ports.

You could easily test if it's true by setting a positive value for output buffer when opening the ports and retest with the port monitor.

Just a blind try...



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 2 of 7
(3,954 Views)
Well. Roberto, i tried with the positive value while openning the comport, but still i could't view in the serial port monitor any other idea's
 
Thanx and Regards,
Venki.
 
0 Kudos
Message 3 of 7
(3,940 Views)

Is your problem regarding actual CVI program or the port monitor? In the second case I cannot help you since I never used this software.

Regarding CVI code, I noticed that you enabled software handshaking on the transmitting port (and not on the receiving one). Since you are transferring bynary data (this part of code comes from me Smiley Wink ) software handshaking is dangerous: you ARE actually transmitting characters 0x11 and 0x13 which are XON and XOFF flags for handshaking so your routine may behave differently from what you expected. I suggest you avoid handshaking and for testing purposes rely only on reading and writing functions.



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 4 of 7
(3,928 Views)
ya..i have some problem with CVI.I am missing something from the following code....
 
In file.dat contains,
 
.Q52.
 
I expect the the result...
 
Character 0: .
Character 1:Q
Character 2: 5
Character 3: 2
Character 4: .
etc.....
 
but i am getting something like this...
 
Character 0:.
Character 1:
Character 2: m
Character 3: h
Character 4:
Character 5:
---------------------------------------------------------------------------------------------------
 .
 
        
 
#include <rs232.h>
#include <formatio.h>
#include <utility.h>
#include <ansi_c.h>
#include <cvirte.h>
int main (int argc, char *argv[])
{
 int  fH = 0;
 int  i, br;
 unsigned char msg[6];
 //FILE *fH = NULL;
 if (InitCVIRTE (0, argv, 0) == 0)
  return -1;    /* out of memory */
 OpenComConfig (2, "", 38400, 0, 8, 1, 512, 1);  // Serial port to write to
 OpenComConfig (3, "", 38400, 0, 8, 1, 512, 1);  // Serial port to read from
 
 //SetXMode(3,1);
 
 fH = OpenFile ("file.dat", VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_BINARY);
 
 ComFromFile (2, fH, 0, -1);
 Delay (0.2);
 br = GetInQLen (3);
 DebugPrintf ("Bytes at port 3: %d\n", br);
 ComRdTerm (3, msg, br, 13);
 
 Delay(6);
 
 for (i = 0; i < 6; i++) DebugPrintf ("Character %d: %c\n", i, msg[i]);
 CloseCom (2);
 CloseCom (3);
 if (fH > 0) CloseFile (fH);
 return 0;
}
 
 
0 Kudos
Message 5 of 7
(3,927 Views)
venki, your code works fine on my machine without problems: I can see the right message received. I noticed that you are using ComRdTerm: since you get the input queue size before reading the port, you could simply use ComRd instead, thus avoiding that a spare carriage return embedded in the file (some line terminator for example) causes ComRdTerm to return before consuming the whole buffer.


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 6 of 7
(3,891 Views)

Roberto thanx.

Hi..!
 
  My device sends a token through the RS 232
  to the host pc. Host PC has a protocol implementation. I could't get the
  clear idea about the protocol. The software tool which uses that protocol
  also sends the same token like .Q6C. After the deive restart, it synchronizes under
  software handshaking.
 
  What is mean by serial port mapping..? Any idea's?.
 
Thanx and regards,
venki
0 Kudos
Message 7 of 7
(3,834 Views)