08-05-2009 03:15 PM
HI can someone send me a tutorial with the actuall code , im trying to verify if the instrument is on, if its not inhibit the user from running test.
basically we are using the rs 232 interface talking to the rs33 chiller from FTS. Im going to send the manual so you can see the different commands, Im a little confuse.
so basically i want to
08-06-2009 04:03 AM
if the instrument is off, it will not reply to any command sent through the serial port. if the instrument is on, it will reply to a status command. from the manual (starting at page 28: chapter 5, RS-232 Communications), the best command available for status queries is "POLL".
so, open your communication port, send "POLL\n" and wait for a reply. if the instrument does not reply, either it is turned off or the communication settings (baud rate, parity, etc...) are not correct. if the instrument is correctly powered-on and set-up, you should receive a line looking like "OK!<CR>". that's all folks !
the actual code should be straightforward, and i am pretty sure you can come up with a working program in no time. you may eventually look at the examples coming with CVI for rs-232 sample code.
08-06-2009 12:45 PM
got you now what i need help trying to write the stand alone code, instead of using the gui thats already in cvi labwindows. so if you can you assist me. i want to verify if the chiller is on , and if its not on prohibit the user from running the test etcc....., i want to do that with a past or fail test. i know cvi has a sample which is the serial communication, but i dont want to use the gui's i just want a standalone source code then im going to creat a exe file. but in that stand alone code i want it to do the basic pass or fail test. the test executive that im going to use is going to call my exe file. through the texVerify(). so i can send that also so you can see the parameters that need to be included. but i got include the texVerify command in my the standalone code. im using ssi text executive. which going to call my exe file.
08-06-2009 12:48 PM
got you now what i need help trying to write the stand alone code, instead of using the gui thats already in cvi labwindows. so if you can you assist me. i want to verify if the chiller is on , and if its not on prohibit the user from running the test etcc....., i want to do that with a past or fail test. i know cvi has a sample which is the serial communication, but i dont want to use the gui's i just want a standalone source code then im going to creat a exe file. but in that stand alone code i want it to do the basic pass or fail test. the test executive that im going to use is going to call my exe file. through the texVerify(). so i can send that also so you can see the parameters that need to be included. but i got include the texVerify command in my the standalone code. im using ssi text executive. which going to call my exe file.
08-12-2009 11:43 AM
Darnell:
I'm not sure where you're having a problem. Writing a function? Verifying communication with your chiller? Returning Pass/Fail status from your function? Interfacing with your test executive?
If your test executive is calling functions in other programs, those functions are usually in DLLs, not EXEs, so your project should build a DLL. See some info here on creating or using DLLs in CVI. http://zone.ni.com/devzone/cda/tut/p/id/3341#toc0
Your function should return the Pass/Fail status to the calling routine. This is done with the return statement, which is the last statement your function will execute. Based on the docx you attached, your function will
return TRUE;
or
return FALSE;
depending on whether you decided it passed (communicated) or failed (didn't communicate).
Are you the first programmer to use this test executive? If not, start by looking at existing working examples of test code that interface with your test executive. Talk to those authors.
Attack your task as two separate issues: verifying communication with the chiller, and interfacing with the test executive.
Start with a simple exe that you can run directly (without the test executive) with a function to verify communication with the chiller.
Then package your function into a DLL that the test executive can call.
08-17-2009 02:29 PM
Hey al s, can you check this program. I trried following your program you sent.
i have one error. but in your program you not getting that error im getting, and im using the same exact variables.
the error is
FATAL RUN-TIME ERROR: "MMWave.c", line 45, col 49, thread id 0x00000D28: Invalid argument type: found 'pointer to int', expected 'pointer to char'.
but if i point it to a char its not working. but in your convert to zip program you are doing
int inputValue;
&inputvalue
so im lost
08-17-2009 02:29 PM
Hey al s, can you check this program. I trried following your program you sent.
i have one error. but in your program you not getting that error im getting, and im using the same exact variables.
the error is
FATAL RUN-TIME ERROR: "MMWave.c", line 45, col 49, thread id 0x00000D28: Invalid argument type: found 'pointer to int', expected 'pointer to char'.
but if i point it to a char its not working. but in your convert to zip program you are doing
int inputValue;
&inputvalue
so im lost
08-17-2009 02:29 PM
Hey al s, can you check this program. I trried following your program you sent.
i have one error. but in your program you not getting that error im getting, and im using the same exact variables.
the error is
FATAL RUN-TIME ERROR: "MMWave.c", line 45, col 49, thread id 0x00000D28: Invalid argument type: found 'pointer to int', expected 'pointer to char'.
but if i point it to a char its not working. but in your convert to zip program you are doing
int inputValue;
&inputvalue
so im lost
08-17-2009 03:03 PM - edited 08-17-2009 03:12 PM
First, it looks like you posted this message which really applied to a different thread. This should have been posted to the thread on binary conversion here: http://forums.ni.com/ni/board/message?board.id=180&thread.id=20094
But to answer your question:
In line 45, the control PANEL_BINARY_READ is a string control, but you're trying to read its value into an int.
You should GetCtrlVal on PANEL_NUMERIC instead of PANEL_BINARY_READ in line 45.
In line 51, you're trying to read the radix value from PANEL_BINARY_READ, but in the example I posted I read from a ring control to get the radixValue.
If all you want to do is to convert to binary, you don't need to get radixValue or test for VAL_BINARY_FORMAT.
In line 53, you're trying to apply an attribute to your string control that only applies to numeric controls (a radix format).
In line 57, you're trying to write a numeric value to a string control.
You deleted most of the controls from my example, and then tried to assign code that applied to those deleted controls to your remaining controls.
Take a closer look at the example I posted, looking at each control, the callback functions for each control, and how their values are read or set in the program. You need a better understanding on the relationship between controls, variables, and callback functions.
Put a few breakpoints in my example and follow the code execution.
Try this as your binary conversion function.
int BINARY_CONVERSION(void)
{
int currentPosition = 0;
int i = 0, inputValue;
char outputString[64];
// read the input value
GetCtrlVal (panelHandle, PANEL_NUMERIC, &inputValue);
// clear the output string
outputString[0] = '\0';
// convert to binary
// count the bits needed
do{
} while (inputValue >= pow(2,currentPosition++));
// show a minumum of 8 bits
if (currentPosition<8)
currentPosition=8;
// terminate the string
outputString[currentPosition] = '\0';
// fill in one bit at a time, from LSB to MSB
do{
if (inputValue & 1 << i++)
outputString[--currentPosition] = '1';
else
outputString[--currentPosition] = '0';
} while (currentPosition > 0);
SetCtrlVal (panelHandle, PANEL_BINARY_READ, outputString);
return 0;
}
08-18-2009 11:28 AM
So GetCtrlVAl is for int? And SetCtrlVal is for strings?