Home > Software engineering >  TCHAR problems encountered in the programmable instruments
TCHAR problems encountered in the programmable instruments

Time:09-16

I've been using MFC adjustable VISA send on SCPI SPC standard instrument and equipment, with the UNICODE character set,

 
TCHAR sztestitem_scpi [200].
Int nLength=lstrlen (sztestitem_scpi);
Status=viWrite (instr, (ViBuf) (sztestitem_scpi), (ViUInt32) lstrlen (ztestitem_scpi), & amp; WriteCount);


Send normal during this time, continue to send
 
Strcpy_s (stringinput, ": price: ERR? \n");
Status=viWrite (instr, ViBuf stringinput, (ViUInt32) strlen (stringinput), & amp; WriteCount);

Equipment according to instructions error,

The
 
Char sztestitem_scpi [200].
Int nLength1=strlen (sztestitem_scpi);
Status=viWrite (instr, ViBuf sztestitem_scpi, (ViUInt32) strlen (sztestitem_scpi), & amp; WriteCount);
If (the status & lt; VI_SUCCESS)
{
Printf (" Error writing to the device % d. \ n ", I +/* */1);
Status=viClose (instr);
}

Strcpy_s (stringinput, ": price: ERR? \n");
Status=viWrite (instr, ViBuf stringinput, (ViUInt32) strlen (stringinput), & amp; WriteCount);

There is no problem.

I want to ask why is this? NLength1 and length nLength, would affect accuracy of instruction? And last request to end with a newline SCPI command, when I was in hair also didn't add "\ n" at the end of the instructions how to is correct, and I'm a little don't understand, consult

CodePudding user response:

Char sztestitem_scpi [200].
Int nLength1=strlen (sztestitem_scpi);
Strings are not initialized, the DEBUG version and RELEASE version will show different results.
To set breakpoints, estimation is an empty string, no send out

UNICODE use char, char * CStringA

CodePudding user response:

reference 1st floor zgl7903 response:
char sztestitem_scpi [200].
Int nLength1=strlen (sztestitem_scpi);
Strings are not initialized, the DEBUG version and RELEASE version will show different results.
To set breakpoints, estimation is an empty string, no send out

UNICODE use char, char * CStringA


Not the oh, I didn't write the whole.. Send the length of the two are the same, is not a mistake

CodePudding user response:

reference 1st floor zgl7903 response:
char sztestitem_scpi [200].
Int nLength1=strlen (sztestitem_scpi);
Strings are not initialized, the DEBUG version and RELEASE version will show different results.
To set breakpoints, estimation is an empty string, no send out

UNICODE use char, char * CStringA

Executed correctly and not correct execution of the instrument response is right, has been operating successfully, so I wonder if it is other what problems, such as \ n these... Don't understand

CodePudding user response:

SCPI command must be to \ r \ n, \ r \ n one of the three end
NI IO Trace can monitor the calling function, passing the arguments and return values




  • Related