MCA527
1 MS-Windows DLL for Communication with MCA166 and
MCA527
The dynamic link library (mca32com.dll) is provided for Win32 applications. It must reside in the Windows system directory or in the
same directory as the calling application. In order to include the DLL in your program, you have to use the file MCA32COM.BAS for
Visual Basic or the files MCA_COMM.H and MCA32COM.LIB for C/C++. All functions and structures are declared in these files.
The description of the communication DLL refers to version 2.07.0008.
2 Initializing and Closing the Communication Port
Before you can use any other function, the communication port must be initialized. There are three functions for initializing the
communication port: COMM_INIT_EX2 initializes a RS232 or USB communication port. COMM_INIT_ETHERNET initializes an
Ethernet communication port. COMM_INIT_SELECT is the most recently added function and usable for all possible communication
ports. It also offers the most comfort for the developer. For this reason, it is the most commendable function.
Before the application will be exited, the communication port has to be closed with COMM_CLOSE. Only one communication port
can be used at the same time. If the communication port shall be changed, the current communication port has to be closed before
the new one can be initialized.
Name
COMM_INIT_EX2
Description The function initializes the RS232 or USB communication.
Declaration
short CALLBACK COMM_INIT_EX2(LPSTR lpszInterface,clock_t lTimeOut,
int nTryAgain,unsigned long ulBaudRate);
lpszInterface
Interface name (e. g. “COM1”)
lTimeOut
Time out [milliseconds] for the communication. It should be set to about 1000 milliseconds, because
there are commands that run a short measurement before they return. The parameter can be set to a
higher value if needed.
nTryAgain
Number of tries to send the command
ulBaudRate
Baud rate (38.400, 115.200, 307.200 or 3.000.000)
Return value If the function succeeds, the return value is nonzero.
Name
COMM_INIT_ETHERNET
Description The function initializes the Ethernet communication.
Declaration
short CALLBACK COMM_INIT_ETHERNET(unsigned short unNumberToFind,
clock_t lTimeOut,int nTryAgain,HWND hWnd);
unNumberToFind
Serial number of the MCA527 which shall be connected to the application.
If the parameter is unequal 0, the function exclusively tries to connect to the MCA527 with this serial
number.
If the parameter is equal 0, the function searches for all available MCA527. If MCA527's are available,
they are displayed in a list, from what the user can choose the desired one.
lTimeOut
Time out [milliseconds] for the communication. It should be set to about 1000 milliseconds, because
there are commands that run a short measurement before they return. The parameter can be set to a
higher value if needed.
nTryAgain
Number of tries to send the command
hWnd
Handle to the parent window
Return value If the function succeeds, the return value is nonzero.
4