7 jida32 windows, Programming, Mopslcdlx software guide – Kontron MOPSlcdLX User Manual
Page 20: 1 program language c, Example
KTD-S0006-B
Page 17
JIDA32 Interface
MOPSlcdLX Software Guide
6.7
JIDA32 Windows
®
Programming
For further information see the actual JIDA32 documentation (JIDA32.pdf).
6.7.1
Program Language C
The demo program reads and shows the board name and the first 16 bytes of SPD EEPROM (SMBus). The
program uses the static linked library JIDA.LIB.
Example:
#include
#include "jida.h"
#define I2C_BUS 1
#define DEV_ADDR 0xA0
INT WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
BOOL
bRet;
HJIDA hJida = (DWORD) NULL;
CHAR
szStr1
[128],
szStr2
[32],
szVal
[JIDA_BOARD_MAX_SIZE_ID_STRING];
UCHAR
uVal
[32];
if (JidaDllInitialize ())
{
if (JidaDllIsAvailable ())
{
if (JidaBoardOpen (JIDA_BOARD_CLASS_CPU, 0, JIDA_BOARDINFO_FLAGS_DEFAULT, &hJida))
{
bRet = JidaBoardGetName (hJida, (LPTSTR) szVal, JIDA_BOARD_MAX_SIZE_ID_STRING);
wsprintf
(szStr1,
"JidaBoardGetName = %d / %s", bRet, szVal);
lstrcpy
(szStr2,
"DEMO");
MessageBox (NULL, szStr1, szStr2, MB_OK | MB_ICONEXCLAMATION);
JidaI2CRead (hJida, I2C_BUS, DEV_ADDR, (LPBYTE) &uVal[0], 16);
wsprintf (szStr1, "JidaI2CRead = %02X %02X %02X %02X %02X %02X %02X %02X",
uVal[0], uVal [1], uVal[2], uVal [3],
uVal[4], uVal [5], uVal[6], uVal [7]);
MessageBox (NULL, szStr1, szStr2, MB_OK | MB_ICONEXCLAMATION);
JidaBoardClose
(hJida);
}
}
JidaDllUninitialize
();
}
return (INT) FALSE;
}