NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a Function

int abcd(void)
{
unsigned char SerialString[25];
int LengthSerialString;
int CheckSum = 0;
int err = 0;

FlushInQ (IBAKA_COMPORT);
FlushOutQ (IBAKA_COMPORT);

SerialString[0]= HEADER_WORD_1;
SerialString[1]= HEADER_WORD_2;
SerialString[2]= MSYNC_KORLEME_BILGILERI_GONDER;
SerialString[3]= MSYNC_GONDER;
SerialString[4]= 0x88; //Checksum
SerialString[5]= '\0';

LengthSerialString = 5;

ComWrt(IBAKA_COMPORT, SerialString, LengthSerialString);

return err;
}

 

I want to create this function but i can't creat .I can't find how can i define a funtion . I use f(x) expression but because of this "{" parameter ,i get syntax error . I understand how can i define parameters and how can i use flow control arguments but i cant find how can i define a funtion. 

0 Kudos
Message 1 of 5
(2,524 Views)

int abcd_Gonder(void)
{
unsigned char SerialString[25];
int LengthSerialString;
int CheckSum = 0;
int err = 0;

FlushInQ (x_COMPORT);
FlushOutQ (x_COMPORT);

SerialString[0]= 1;
SerialString[1]= 2;
SerialString[2]= 3;
SerialString[3]= 4;
SerialString[4]= 0x88; //Checksum
SerialString[5]= '\0';

LengthSerialString = 5;

ComWrt(x_COMPORT, SerialString, LengthSerialString);

return err;
}

 

I want to send this message using RS232 port. I have to use teststand parameters to create this function. So I can't write this code in visial studio using class librarry to export dll . I'm new at TestStand and I need help that how can I create a function like this.

0 Kudos
Message 2 of 5
(2,512 Views)

Is there any particular reason you have to use TestStand parameters to accomplish this? I would imagine it would be very easy to just use to the C/C++ DLL Adapter to use this function you have already written.

 

There is also the option to create a custom step type for repeated use. The VISA Custom Step Type is an example of this, but either way, you will have to utilize a c/c++ environment at some point.

0 Kudos
Message 3 of 5
(2,472 Views)

My costumer want to edit code and want to be able to adjust itself when parameters change in the future

0 Kudos
Message 4 of 5
(2,459 Views)

The variables/parameters can be created and edited within the TestStand environment and then passed to your functions. The actual code C++ commands will still need to be written externally and called using the C/C++ DLL Adapter. Within TestStand, the functions you have written in the DLL can be selected and utilized within the API.

 

As far as I know, you can't write/edit C/C++ functions from within TestStand. 

0 Kudos
Message 5 of 5
(2,449 Views)