- // MilApp.cpp
- //
- /*---------------------------------------------
- 本 Demo 以 Cronosplus 采集 CCIR 信号为例。
- 实现功能:连续采集,单帧抓取,保存图片,显示
- 注意:1) 请将 MsysAlloc 的第一项参数改成您所使用的板卡类型
- 2) 请将 MdigAlloc 的第三项参数改成您所使用的 dcf 文件
- -----------------------------------------------*/
- #include "stdafx.h"
- #include "MilApp.h"
- MIL_ID MilApplication;
- MIL_ID MilSystem;
- MIL_ID MilDigitizer;
- MIL_ID MilDisplay;
- MIL_ID MilImage;
- char g_aFileNameOfDCF[31]="dcffile.dcf";
- //MiL初始化
- bool MilCreate()
- {
- /* 分配 App */
- MappAlloc(M_DEFAULT, &MilApplication);
- /* 分配 system. */
- MsysAlloc(M_SYSTEM_CRONOSPLUS, M_DEF_SYSTEM_NUM, M_SETUP, &MilSystem);
- /*分配 digitizer. */
- MdigAlloc(MilSystem,
- M_DEFAULT,
- "M_CCIR", M_DEFAULT,
- &MilDigitizer);
- /* 分配 display. */
- MdispAlloc(MilSystem,
- M_DEFAULT,
- M_DISPLAY_SETUP,
- M_WINDOWED,
- &MilDisplay);
- long g_BufSizeX = (unsigned int) MdigInquire(MilDigitizer, M_SIZE_X, M_NULL);
- long g_BufSizeY = (unsigned int) MdigInquire(MilDigitizer, M_SIZE_Y, M_NULL);
- long g_BufSizeBand = (unsigned int) MdigInquire(MilDigitizer, M_SIZE_BAND, M_NULL);
- /* 分配 buffer. */
- MbufAlloc2d(MilSystem,
- g_BufSizeX,
- g_BufSizeY,
- 8L+M_UNSIGNED,
- M_IMAGE+M_GRAB+M_PROC+M_DISP,
- &MilImage);
- MbufClear(MilImage, 0);
- return true;
- }
- //MiL资源释放
- bool MilDestroy()
- {
- MdispDeselect(MilDisplay, MilImage);
- MbufFree(MilImage);
- MdispFree(MilDisplay);
- MdigFree(MilDigitizer);
- MsysFree(MilSystem);
- MappFree(MilApplication);
- return true;
- }