09-08-2009 07:06 AM
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".
09-08-2009 08:38 AM
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
09-08-2009 09:06 AM - edited 09-08-2009 09:13 AM
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"
09-08-2009 10:48 AM
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?
09-08-2009 10:55 AM
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);
09-08-2009 11:07 AM
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.
09-08-2009 11:07 AM
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
09-08-2009 11:09 AM
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
09-08-2009 11:10 AM
09-08-2009 11:18 AM