LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

device card

Which value are you getting? Which value were you expecting? Why?

 

 

 

 

BTW   I normally don't set the verbose name of the com port in OpenComConfig in order to avoid conflicts between system and CVI settings. That is: do not set

   bytes_sent= OpenComConfig(COMPORT,"COM10",BAUDRATE,PARITY,DATABITS,STOPBITS,INPUTQ,OUTPUTQ);

Set this way instead

   bytes_sent= OpenComConfig(COMPORT,"",BAUDRATE,PARITY,DATABITS,STOPBITS,INPUTQ,OUTPUTQ);


So you will avoid any problem due to the difference between COMPORT = 1 and "COM10".



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 31 of 80
(1,952 Views)

nevermind i close down the project and reopen, and then it goes back to normal, thats weird. why do it say -3 for bytes_sent and im sending 7 out.

 

 

also  for this   bytes_sent= OpenComConfig(COMPORT,"",BAUDRATE,PARITY,DATABITS,STOPBITS,INPUTQ,OUTPUTQ);

 

so do i do a #define DEVICENAME        COM10    at the top

0 Kudos
Message 32 of 80
(1,939 Views)

The time has come for you to add some error checking to your code: -3 is an error code that stands for "Port not open" Smiley Surprised

Message Edited by Roberto Bozzolo on 09-08-2009 04:13 PM


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 33 of 80
(1,936 Views)

Darnell:

 

The first thing to do when you get a return value from a CVI library function that you don't understand is to check the CVI help on the function.  While editing your code, you can right-click on the CVI function name and select Recall Function Panel.  On the function panel, you can right-click on any parameter or return value and you'll get the help for that parameter.

 

I have a couple of comments on the following line of code from your previous post.

bytes_sent= OpenComConfig(COMPORT,"",BAUDRATE,PARITY,DATABITS,STOPBITS,INPUTQ,OUTPUTQ);

 

I understand the short-cut of re-using variable names, but be sure that you understand that OpenComConfig does not write anything and does not return the number of bytes_sent.  Why would you expect OpenComConfig to return 7 because you intend to later write 7 bytes using ComWrt?

 

Why do you ask about defining COM10 when it looks like you're using COM1?  Which do you want to use?

0 Kudos
Message 34 of 80
(1,915 Views)

   i dont know why i ask that question. i was on the slow bus.

 

this how i did the OpenComConfigfor the comport.

 

is this cool below?

 

 

 

  static char COM[6] = "COM10\0";
 

 

    bytes_sent= OpenComConfig(COMPORT,COM,BAUDRATE,PARITY,DATABITS,STOPBITS,INPUTQ,OUTPUTQ);

0 Kudos
Message 35 of 80
(1,913 Views)

Darnell:

 

Roberto already suggested to you that you leave the Device Name blank (where you are using your COM variable).  Look at the help for the Device Name parameter on OpenComConfig to see some additional info.  I agree with Roberto (no surprises there).  Leave the Device Name blank ("") if you don't get errors from the device driver.

 

What does "COM10\0" mean?  Are you trying to append the NULL character to your string?  The compiler already does that for you.

0 Kudos
Message 36 of 80
(1,910 Views)

Our comport COM1 is being use with another device,  and we have an RS 232 ENET CONVERTER with four extra ports.

 

and port 1 for the enet converter is COM10

0 Kudos
Message 37 of 80
(1,909 Views)

also i did understood , i just had a blank in my mind for a moment.

 

i know what -2, -3,-7,-99.   I know what they mean, just wasnt think at the moment

0 Kudos
Message 38 of 80
(1,906 Views)
excuse the grammer , typing to fast
0 Kudos
Message 39 of 80
(1,905 Views)
If you don't use a blank Device Name, you need to have the Device Name agree with the COM Port.  In the last code you posted, you had COM Port of 1 and a Device Name of COM10.  That's why I asked previously which one you wanted to use.  Don't try to use them both in the same OpenComConfig statement.
0 Kudos
Message 40 of 80
(1,903 Views)