
18.
Software Examples
Explanation to the software examples:
To integrate the
LAM
- sensors in an existing software a DLL is available. More details are available on request.
Our software development engineers use Visual Studio / C++. The source code should be considered as an example. This code could
have bugs and we cannot offer guarantees for the accuracy or the completeness of data.
We
may change the code examples without
notice.
Header:
#define
M27ILANPROTOKOL2302ETHERNETPACKETSIZE 860
#define
ADVALUESPROTOKOL2302MAX 200
typedef struct
{
unsigned int uiVersionProtokol;
//2 0x2302
unsigned int uiVersionProtokolSize;
//2 860
unsigned int uiSerienNummerMJ;
//2 MMJJ
unsigned int uiSerienNummerCnt;
//2 XXX
unsigned long ulEinschaltzaehler;
//4
unsigned char ucReserved[20];
//20
unsigned int uiPacketNummer;
//2 consecutive number
unsigned char ucEthSpeed;
//1 10/100-MBit/s
unsigned char Reserved1[3];
//3
unsigned int uiAMB;
//2 Range begin
unsigned int uiMB;
//2 Range
unsigned int uiTriggerMaxValue;
//2 value adjusted in web browser
unsigned int uiTriggerMinValue;
//2 value adjusted in web browser
unsigned char ucTriggerMaxIntensity;
//1 142
unsigned char ucTriggerMinIntensity;
//1 14
unsigned int uiTriggerStatus;
//2 (uiTriggerMax << 1) | uiTriggerMin
unsigned int uiReserved2;
//2
unsigned int uiADZMaxValue;
//2 0xFFFF
unsigned int uiADIMaxValue;
//2 0xFF
unsigned int uiADFrequenz;
//2 30000
unsigned int uiADValuesMax;
//2 200
unsigned int uiADValues[ADVALUESPROTOKOLMAX]; //2x200:400
unsigned char chADIValues[ADVALUESPROTOKOLMAX]; //1x200:200
unsigned char chADLValues[ADVALUESPROTOKOLMAX]; //1x200:200
} _structADValues; //860
Ethernet Sensor Software Implementation:
For the communication between sensor and Ethernet interface so called “WinSocket” functions are used. These functions are part of all
Windows operating systems. Other operating systems may use similar functions. Winsock functions are encapsuled in a „ws2_32.dll“-file.
This file is part of the Windows operating system. The communication uses a TCP/IP protocol and the sensor works as a server. This
implicates that the PC must be programmed as a client.
At the beginning the „WSAStartup“ function must be called, so that the common functions of WindowsSocket can be used. Next step is to
get get a valid TCP-Socket (something like: object) from the system. This is done by calling „socket“.
As soon as a valid socket is available a connection with the sensor can be established. This is made with the function „connect“.
Now the PC is connected to the sensor and both units can exchange data with the commands „send“ and „recv“.
At the end of the communication cycle all memories and sockets should be released using „closesocket“.
Finally the function „WSACleanup“ must be carried out.
16
V_2018_08_20
Содержание LAM Series
Страница 19: ...19 Appendix 19 1 Dimensional Drawings Sensor Heads 19 V_2018_08_20 LAM 0 5 Weight 250 g LAM 2 Weight 250 g ...
Страница 20: ...20 V_2018_08_20 LAM 4 Weight 250 g LAM 10 Weight 250 g ...
Страница 21: ...21 V_2018_08_20 LAM 20 Weight 250 g LAM 50 Weight 480 g ...
Страница 22: ...22 V_2018_08_20 LAM 100 Weight 480 g ...
Страница 23: ...23 V_2018_08_20 LAM 200 Weight 480 g ...