I want integrate a header .h or .dll file in CAPL (concretly Visa32.dll, visa.h or sicl.h) to control a multimeter 34461A. How can I include the .h files or .dll file in CANoe? I created an ECU module called multimeter. Thanks,
Enter the DLL in the Options dialog in CANoe. In this case, the DLL will be available to all CAPL programs. You can enter the DLL in the includes section of a CAPL program using the #pragma library command. In this case, it will only be available to this program.
CAPL is a scripting language that is used to access the CAN protocol with Logical operations. With this, it is possible simulate anything on CAN network using the script code which is almost like C. The script can be used with Vector CANOe and Vector CANalyzer.
Including external DLLs in CAPL is possible, but you will need to create a wrapper for all the functions you're going to use.
Take a look at \CANoe\Demo_AddOn\Capldll
directorty which features such a wrapper. It's a MSVC project exporting a few simple functions to CAPL, like int f(int a, int b) {return a+b;}
.
What you will need to to is to add your library files (Visa32.dll, visa.h) to this Capldll project and define wrappers for all the functions you want to call from CANoe. For example, if you have int visa_init(double arg)
in Visa32.dll, you will create a wrapper:
int CAPLEXPORT far CAPLPASCAL capl_visa_init(double arg)
{
return visa_init(arg);
}
You will also need to add the prototype of your function to the export table:
CAPL_DLL_INFO CAPL_DLL_INFO_LIST[] =
{
{"my_visa_init", (CAPL_FARCALL)capl_visa_init, 'D', 1, "F", "\000"},
....
{0,0}
};
Once you have successfully build your wrapper DLL (it will be called capldll.dll if you reuse the example), you will need to import it in CANoe, and you will be able to call the function by the name you defined in the export table, e.g. my_visa_init(1.0);
CAPL is not C. You can not include .h files.
The easiest would be to control the multimeter over the GPIB bus. Take a look at the CAPL GPIB library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With