Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

Problem talking thru USB CDC serial device using a virtual comm port in CVI

I am using a PIC18F4550 USB controller in CDC mode.  When I plug the PC to it I see a new COM port, as expected.  I can use Hyperterminal to communicate to it just fine.  I have used a few terminal programs, they all work fine.
When I use CVI it does not communicate.   I tried obth OpenComConfig( )  and OpenCom( ).  I know the parameters in the OpenComConfig  do not make any difference, but I played around with them anyway.
I do not get any errors returned from the comm functions.
What is going on?
Here is an example of a routine.
void Write_Data(int iCommPort, unsigned char d)   {
    int iSuccess, iCount,iOpenCommResult;
    iOpenCommResult = OpenComConfig (iCommPort, "COM5", 9600, 0, 8, 2, 512, -1); 
    iCount = strlen(sBuffer);
    iSuccess = ComWrt (iCommPort, sBuffer, iCount);
    CloseCom (iCommPort);
0 Kudos
Message 1 of 4


When ever I have problems talking to a device, I open up a Visa Test Panel in MAX (Devices) for the device.
This allows a basic check by writing (viWrite tab) and reading (viRead tab) to/from the device, it's a bit like
using Hyperterminal but you get to check the NI way.



0 Kudos
Message 2 of 4
Thanks Gary.   My MAX didn't have any devices listed so I installed the drivers and they showed up.   Also, NI support suggested I download "portmon" from Microsoft to monitor serial communications.
Bottom line, it's working now.  I needed to use a output buffersize of -1 and a different termination character.
Thanks again. - Phil
0 Kudos
Message 3 of 4

Following up in case anyone else's search leads here.

I'm controlling an Omega CN606 with a USB comport adaptor.

It worked just fine with a LabView example found on  these boards, but the equivalent CVI failed.

The issue was termination character.


Either the adaptor, or its driver, or CVI is appending it automatically.

The LF specified in the device manual and appearing in the LabView Configure Serial Port should be omitted for the command string I send from my CVI program.

If it is there, it fouls communication.


Just FYI.

Message 4 of 4