#include <mil.h>
#define GRAB_SCALE 1.0
int MosMain(void)
{
MIL_ID MilApplication;
MIL_ID MilSystem;
MIL_ID MilDigitizer[2];
MIL_ID MilDisplay[2];
MIL_ID MilImageDisp[2];
MappAlloc(M_NULL, M_DEFAULT, &MilApplication);
MsysAlloc(M_DEFAULT, MIL_TEXT("M_DEFAULT"), M_DEFAULT, M_DEFAULT, &MilSystem);
MdigAlloc(MilSystem, M_DEV0, MIL_TEXT("M_DEFAULT"), M_DEFAULT, &MilDigitizer[0]);
MdigAlloc(MilSystem, M_DEV1, MIL_TEXT("M_DEFAULT"), M_DEFAULT, &MilDigitizer[1]);
MdispAlloc(MilSystem, M_DEFAULT, MIL_TEXT("M_DEFAULT"), M_DEFAULT, &MilDisplay[0]);
MdispAlloc(MilSystem, M_DEFAULT, MIL_TEXT("M_DEFAULT"), M_DEFAULT, &MilDisplay[1]);
MbufAlloc2d(MilSystem,
(MIL_INT)(MdigInquire(MilDigitizer[0], M_SIZE_X, M_NULL)*GRAB_SCALE),
(MIL_INT)(MdigInquire(MilDigitizer[0], M_SIZE_Y, M_NULL)*GRAB_SCALE),
8L+M_UNSIGNED,
M_IMAGE+M_GRAB+M_PROC+M_DISP, &MilImageDisp[0]);
MbufClear(MilImageDisp[0], 0x0);
MbufAlloc2d(MilSystem,
(MIL_INT)(MdigInquire(MilDigitizer[1], M_SIZE_X, M_NULL)*GRAB_SCALE),
(MIL_INT)(MdigInquire(MilDigitizer[1], M_SIZE_Y, M_NULL)*GRAB_SCALE),
8L+M_UNSIGNED,
M_IMAGE+M_GRAB+M_PROC+M_DISP, &MilImageDisp[1]);
MbufClear(MilImageDisp[1], 0x80);
MdispSelect(MilDisplay[0], MilImageDisp[0]);
MdispSelect(MilDisplay[1], MilImageDisp[1]);
MdigControl(MilDigitizer[0], M_GRAB_SCALE, GRAB_SCALE);
MdigGrabContinuous(MilDigitizer[0],MilImageDisp[0]);
MdigControl(MilDigitizer[1], M_GRAB_SCALE, GRAB_SCALE);
MdigGrabContinuous(MilDigitizer[1],MilImageDisp[1]);
MosPrintf(MIL_TEXT("Press <Enter> to stop continuous grab.\n"));
MosGetch();
MdigHalt(MilDigitizer[0]);
MdigHalt(MilDigitizer[1]);
MosPrintf(MIL_TEXT("Press <Enter> to end.\n"));
MosGetch();
MbufFree(MilImageDisp[0]);
MbufFree(MilImageDisp[1]);
MdispFree(MilDisplay[0]);
MdispFree(MilDisplay[1]);
MdigFree(MilDigitizer[0]);
MdigFree(MilDigitizer[1]);
MsysFree(MilSystem);
MappFree(MilApplication);
return 0;
}