07-01-2013 01:00 PM
I have tried running VISA calls in DLL based on both examples provided by Rolfk and BTC_Admin. Unfortunately, I could not find the right way to read back into VB refnum *VISAResourceName and was getting error.
* VISA_Open
*/
int32_t __cdecl VISA_Open(char ComName[], int32_t ErrorValIn,
uintptr_t *VISAResourceName);
I had more success with the other option with VISA_Open prototype
void __cdecl VISA_Open(char ComName[], int32_t ErrorValIn);
/*!
VISA_Open seems working correctly with error=0.I have also tried to run it in Labview front panel and I could see my COM port resource name does show up in "VISA_ref.vi”
However, when calling this VISA_Write function from VB
int32_t __cdecl VISA_Write(char TxStr[], int32_t ErrorValIn);
I am getting an errorOut = -1073807346. The same error I am getting if I run this VISA _Write.vi directly from the front panel. I thought that the reference is kept in "VISA_ref.vi" and is visible to all attached VISA functions in the DLL, but it looks like VISA_Write does not get the resource reference from "VISA_ref.vi”. Or could it be anything else I am missing?