EURESYS的picolo擷取卡驅動 |
尚未結案
|
GN00291313
一般會員 發表:5 回覆:5 積分:2 註冊:2009-04-14 發送簡訊給我 |
小弟之前用BCB玩過EURESYS的picolo擷取卡驅動,最近又開始重新寫發現
驅動的程式碼都編譯過了,"multicam.def"檔案也加在Project裡面(如附檔), 比照之前寫的驅動程式碼(影像正常顯示)是ㄧ樣的,重新寫的卻沒有影像出來, 我好像少了ㄧ道程序太久沒寫忘記了>"<,希望有接觸過的大大們,可否指點一下小弟>< 卸卸!! [code cpp] //--------------------------------------------------------------------------- #include #pragma hdrstop #include "multicam.h" #include #include #include #include "Unit1.h" #define ImageW 400 #define ImageH 400 //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "CGAUGES" #pragma link "CGAUGES" #pragma resource "*.dfm" TForm1 *Form1; unsigned char RawData[ImageW*ImageH]; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { m_Channel=0; m_pCurrent=NULL; m_SizeX=0; m_SizeY=0; m_pBitmapInfo=0; m_StatusBarText=""; m_FrameRate_Hz=0.0; m_ChannelState=MC_ChannelState_ORPHAN; MCSTATUS Status; McOpenDriver(NULL); McSetParamInt(MC_CONFIGURATION,MC_ErrorHandling,MC_ErrorHandling_MSGBOX); McSetParamStr(MC_CONFIGURATION,MC_ErrorLog,"error.log"); McCreate(MC_CHANNEL_VALUE_M,&m_Channel); McSetParamInt(m_Channel,MC_DriverIndex,0); //McSetParamStr(m_Channel,MC_CamFile,"Weiche.cam"); McSetParamStr(m_Channel,MC_CamFile,"IPX-1M-48L-Single.cam"); McSetParamInt(m_Channel,MC_Expose_us,20000); McSetParamInt(m_Channel,MC_AcquisitionMode,MC_AcquisitionMode_SNAPSHOT); McSetParamInt(m_Channel,MC_TrigMode,MC_TrigMode_IMMEDIATE); McSetParamInt(m_Channel,MC_NextTrigMode,MC_NextTrigMode_REPEAT); McSetParamInt(m_Channel,MC_SeqLength_Fr,MC_INDETERMINATE); McGetParamInt(m_Channel,MC_ImageSizeX,&m_SizeX); McGetParamInt(m_Channel,MC_ImageSizeY,&m_SizeY); McGetParamInt(m_Channel,MC_BufferPitch,&m_BufferPitch); McSetParamInt(m_Channel,MC_SurfaceCount,EURESYS_SURFACE_COUNT); McSetParamInt(m_Channel,MC_SignalEnable MC_SIG_SURFACE_PROCESSING,MC_SignalEnable_ON); McRegisterCallback(m_Channel,GlobalCallback,this); m_pBitmapInfo=(BITMAPINFO*)new BYTE[sizeof(BITMAPINFO) 255*sizeof(RGBQUAD)]; m_pBitmapInfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); m_pBitmapInfo->bmiHeader.biPlanes=1; m_pBitmapInfo->bmiHeader.biBitCount=8; m_pBitmapInfo->bmiHeader.biCompression=BI_RGB; m_pBitmapInfo->bmiHeader.biSizeImage=0; m_pBitmapInfo->bmiHeader.biXPelsPerMeter=0; m_pBitmapInfo->bmiHeader.biYPelsPerMeter=0; m_pBitmapInfo->bmiHeader.biClrUsed=0; m_pBitmapInfo->bmiHeader.biClrImportant=0; m_pBitmapInfo->bmiHeader.biWidth=m_BufferPitch ; m_pBitmapInfo->bmiHeader.biHeight=-(int)m_SizeY ; for(int i=0;i<256;i ) { m_pBitmapInfo->bmiColors[i].rgbBlue=(BYTE)i; m_pBitmapInfo->bmiColors[i].rgbGreen=(BYTE)i; m_pBitmapInfo->bmiColors[i].rgbRed=(BYTE)i; m_pBitmapInfo->bmiColors[i].rgbReserved=0; } McSetParamInt(m_Channel,MC_ChannelState,MC_ChannelState_ACTIVE); } //--------------------------------------------------------------------------- void WINAPI GlobalCallback (PMCSIGNALINFO SigInfo) { if (SigInfo && SigInfo->Context) { TForm1* pTForm1 = (TForm1*) SigInfo->Context ; pTForm1->Callback (SigInfo); } } //--------------------------------------------------------------------------- void TForm1::Callback(PMCSIGNALINFO SigInfo) { if (SigInfo->Signal == MC_SIG_SURFACE_PROCESSING) { // Update "current" surface address pointer McGetParamInt (SigInfo->SignalInfo, MC_SurfaceAddr, (PINT32) &m_pCurrent); //---------------------------------------- // // Insert the eVision code here. // //---------------------------------------- // Post screen refresh message RECT recpict ; recpict.left =0; recpict.top =0; recpict.right = m_SizeX-1; recpict.bottom = m_SizeY -1; InvalidateRect(Handle,&recpict,false); } else if (SigInfo->Signal == MC_SIG_SURFACE_PROCESSING) { // Insert your failure handling code here. } } //--------------------------------------------------------------------------- void __fastcall TForm1::FormPaint(TObject *Sender) { // Protection if (m_pCurrent==NULL) return; // Get DC of the window HDC hDevice = GetDC (Panel1->Handle); // Display picture SetDIBitsToDevice (hDevice, 0, 0, m_SizeX, m_SizeY, 0, 0, 0, m_SizeY, m_pCurrent, m_pBitmapInfo, DIB_RGB_COLORS); // Release DC ReleaseDC(Handle,hDevice); // Display channel info on status bar // Retrieve the channel state McGetParamInt (m_Channel,MC_ChannelState,&m_ChannelState); // Retrieve the frame rate double frameRate_Hz; McGetParamFloat(m_Channel,MC_PerSecond_Fr,&frameRate_Hz); // Display frame rate and channel state StatusBar1->Panels->Items[0]->Text = m_StatusBarText.sprintf(" Frame Rate: %.2f, Channel State: %s", frameRate_Hz, (m_ChannelState == MC_ChannelState_ACTIVE? "ACTIVE" : "NOT ACTIVE")); } //--------------------------------------------------------------------------- void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action) { // Set the channel to IDLE before deleting it. McSetParamInt (m_Channel,MC_ChannelState,MC_ChannelState_IDLE); // Delete the channel McDelete (m_Channel); // Terminate driver McCloseDriver (); // Delete bitmap info if (m_pBitmapInfo) delete m_pBitmapInfo; } //--------------------------------------------------------------------------- [/code] 以上程式碼跟我之前寫的(正常Work)一樣...只是把它貼在新的視窗就掛囉>< 我在想會不會是我加"multicam.def"檔案在Project裡面的方法不對,我是直接在Project右鍵Add.... 編輯記錄
|
friendlly
高階會員 發表:22 回覆:144 積分:103 註冊:2003-04-08 發送簡訊給我 |
|
GN00291313
一般會員 發表:5 回覆:5 積分:2 註冊:2009-04-14 發送簡訊給我 |
|
friendlly
高階會員 發表:22 回覆:144 積分:103 註冊:2003-04-08 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |