全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2654
推到 Plurk!
推到 Facebook!

請問大大指點 BCB 呼叫 Form2 , Form2 如何使用 TIIC 的類別,Compile才可以成功

尚未結案
teddy470
一般會員


發表:2
回覆:1
積分:0
註冊:2008-09-02

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-09-02 22:44:28 IP:59.104.xxx.xxx 訂閱

//---------------------------------------------------------------------------
#include
#pragma hdrstop

#include "main.h"
#include "CE6353_Unit2.h"
#include "6353.h"
#include "IIC.h"
#include "FQD1116.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "PERFGRAP"
#pragma link "CSPIN"
#pragma link "CGRID"
#pragma resource "*.dfm"
TForm1 *Form1;
T6353 g_T6353;
TIIC g_TIIC;
T1116 g_T1116;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner)
{
Tuner_Adr=0xC0;
Tuner_IF_Adr=0x86;
System_Type=1;


}

//---------------------------------------------------------------------------
void __fastcall TForm1::Write_ButtonClick(TObject *Sender)
{
WORD adr;
BYTE value;
adr=Address_Edit->Text.ToInt();
if( adr > 255 )
{
MessageBox(NULL, "Address Range:0~255","ERROR",MB_OK);
//Address_Edit->Text=Freq_Index;
Address_Edit->SetFocus();
return;
}
bAdrIndex = (BYTE)adr;
Address_Edit->Text=bAdrIndex;
// Open Parellel port
if( g_TIIC.IIC_Open() == false )
{
Memo->Font->Color = clRed;
Memo->Lines->Add( "Can't Access Parellel Port, Please Check PC setting" );
return;
}
value=Write_Edit->Text.ToInt();
if(g_TIIC.IIC_WriteByte( 0xA0,bAdrIndex,value ) == false)
{
Memo->Lines->Clear();
Memo->Font->Color = clRed;
Memo->Lines->Add( "Can't write IIC" );
}
Sleep( 10 ); //delay 10 mS
// Disable Parellel port
g_TIIC.IIC_Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Read_ButtonClick(TObject *Sender)
{
WORD adr;
BYTE value_R;
int i;
adr=Address_Edit->Text.ToInt();
if( adr > 255 )
{
MessageBox(NULL, "Address Range:0~255","ERROR",MB_OK);
Address_Edit->Text=bAdrIndex;
Address_Edit->SetFocus();
return;
}
bAdrIndex = (BYTE)adr;
Address_Edit->Text=bAdrIndex;

// Open Parellel port
if( g_TIIC.IIC_Open() == false )
{
return;
}
g_TIIC.IIC_ReadByte(0xA0, bAdrIndex, &value_R );//IIC_Read byte
Read_Edit->Text=IntToHex(value_R,2); //

// Disable Parellel port
g_TIIC.IIC_Close();
}
//---------------------------------------------------------------------------





void __fastcall TForm1::Tuner_AdrComboBoxChange(TObject *Sender)
{
BYTE index;
AnsiString buf;
index=Tuner_AdrComboBox->ItemIndex;
if(index==0)
{
Tuner_Adr=0xC0;
buf=(IntToHex(Tuner_Adr,2));
buf="Tuner Address 0x" buf;
Memo->Lines->Add(buf);
}
else if(index==1)
{
Tuner_Adr=0xC2;
buf=(IntToHex(Tuner_Adr,2));
buf="Tuner Address 0x" buf;
Memo->Lines->Add(buf);
}
else if(index==2)
{
Tuner_Adr=0xC4;
buf=(IntToHex(Tuner_Adr,2));
buf="Tuner Address 0x" buf;
Memo->Lines->Add(buf);
}
else if(index==3)
{
Tuner_Adr=0xC6;
buf=(IntToHex(Tuner_Adr,2));
buf="Tuner Address 0x" buf;
Memo->Lines->Add(buf);
}

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Tuner_IF_AdrComboBoxChange(TObject *Sender)
{
BYTE index;
AnsiString buf;
index=Tuner_IF_AdrComboBox->ItemIndex;
if(index==0)
{
Tuner_IF_Adr=0x84;
buf=(IntToHex(Tuner_IF_Adr,2));
buf="Tuner IF Address 0x" buf;
Memo->Lines->Add(buf);
}
else if(index==1)
{
Tuner_IF_Adr=0x86;
buf=(IntToHex(Tuner_IF_Adr,2));
buf="Tuner IF Address 0x" buf;
Memo->Lines->Add(buf);
}

}
//---------------------------------------------------------------------------
void __fastcall TForm1::ATV_SystemComboBoxChange(TObject *Sender)
{
BYTE index;
index=ATV_SystemComboBox->ItemIndex;

if(index==0) //B/G
System_Type=1;
else if(index==1)//D/K
System_Type=2;
else if(index==2)//I
System_Type=3;
else if(index==3)//L
System_Type=4;
else if(index==4)//L'
System_Type=5;
else if(index==5)//DVB-T
System_Type=6;


}
/*---------------------------------------------------------------------------



-----------------------------------------------------------------------------*/









void __fastcall TForm1::Read_POLLButtonClick(TObject *Sender)
{
BYTE PLL_R_Value=0;
bool P_D0,P_D1,P_D2,P_D3,P_D4,P_D5,P_D6,P_D7;

// Open Parellel port
if( g_TIIC.IIC_Open() == false )
{
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);
g_T1116.FQD1116ME_Tuner_Part_ReadByte(Tuner_Adr,&PLL_R_Value) ; //IIC_Read byte
//POLL Read Mode
P_D0 = (PLL_R_Value & 0x01) ? 1:0;
P_D1 = (PLL_R_Value & 0x02) ? 1:0;
P_D2 = (PLL_R_Value & 0x04) ? 1:0;
P_D3 = (PLL_R_Value & 0x08) ? 1:0;
P_D4 = (PLL_R_Value & 0x10) ? 1:0;
P_D5 = (PLL_R_Value & 0x20) ? 1:0;
P_D6 = (PLL_R_Value & 0x40) ? 1:0;
P_D7 = (PLL_R_Value & 0x80) ? 1:0;

A0_Edit->Text=(BYTE)P_D0;
A1_Edit->Text=(BYTE)P_D1;
A2_Edit->Text=(BYTE)P_D2;
A3_Edit->Text=(BYTE)P_D3;
A4_Edit->Text=(BYTE)P_D4;
A5_Edit->Text=(BYTE)P_D5;
A6_Edit->Text=(BYTE)P_D6;
A7_Edit->Text=(BYTE)P_D7;

// CE6353 I2C passthrough disconnector
g_T6353.CE6353_I2C_PassThrough_Setting(0) ;
}
//---------------------------------------------------------------------------









void __fastcall TForm1::IF_ReadButtonClick(TObject *Sender)
{
BYTE IF_R_Value=0;
bool P_D0,P_D1,P_D2,P_D3,P_D4,P_D5,P_D6,P_D7;

// Open Parellel port
if( g_TIIC.IIC_Open() == false )
{
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);
g_T1116.FQD1116ME_Tuner_Part_ReadByte(Tuner_IF_Adr,&IF_R_Value) ; //IIC_Read byte
//POLL Read Mode

P_D0 = (IF_R_Value & 0x01) ? 1:0;
P_D1 = (IF_R_Value & 0x02) ? 1:0;
P_D2 = (IF_R_Value & 0x04) ? 1:0;
P_D3 = (IF_R_Value & 0x08) ? 1:0;
P_D4 = (IF_R_Value & 0x10) ? 1:0;
P_D5 = (IF_R_Value & 0x20) ? 1:0;
P_D6 = (IF_R_Value & 0x40) ? 1:0;
P_D7 = (IF_R_Value & 0x80) ? 1:0;
IF_D0Edit->Text=(BYTE)P_D0;
IF_D1Edit->Text=(BYTE)P_D1;
IF_D2Edit->Text=(BYTE)P_D2;
IF_D3Edit->Text=(BYTE)P_D3;
IF_D4Edit->Text=(BYTE)P_D4;
IF_D5Edit->Text=(BYTE)P_D5;
IF_D6Edit->Text=(BYTE)P_D6;
IF_D7Edit->Text=(BYTE)P_D7;
// CE6353 I2C passthrough disconnector
g_T6353.CE6353_I2C_PassThrough_Setting(0) ;
}
//---------------------------------------------------------------------------












void __fastcall TForm1::Send_ButtonClick(TObject *Sender)
{
BYTE DB1_Data,DB2_Data,CB1_Data,CB2_Data;
BYTE Tu_Adr;

Tu_Adr =ADB_Edit->Text.ToInt();
DB1_Data =DB1_Edit->Text.ToInt();
DB2_Data =DB2_Edit->Text.ToInt();
CB1_Data =CB1_Edit->Text.ToInt();
CB2_Data =CB2_Edit->Text.ToInt();
// Open Parellel port
if( g_TIIC.IIC_Open() == false )
{
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);

if(g_T1116.FQD1116ME_Tuner_Part_Programming(Tu_Adr,DB1_Data,DB2_Data,CB1_Data,CB2_Data)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
return;
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::IF_WriteButtonClick(TObject *Sender)
{
BYTE W1_Data,W2_Data,W3_Data,W4_Data,W5_Data,W6_Data,W7_Data,W8_Data,W9_Data,W10_Data;
W1_Data =W1_Edit->Text.ToInt();
W2_Data =W2_Edit->Text.ToInt();
W3_Data =W3_Edit->Text.ToInt();
W4_Data =W4_Edit->Text.ToInt();
W5_Data =W5_Edit->Text.ToInt();
W6_Data =W6_Edit->Text.ToInt();
W7_Data =W7_Edit->Text.ToInt();
W8_Data =W8_Edit->Text.ToInt();
W9_Data =W9_Edit->Text.ToInt();
W10_Data =W10_Edit->Text.ToInt();
// Open Parellel port
if( g_TIIC.IIC_Open() == false )
{
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);

if(g_T1116.FQD1116ME_IF_Part_Initial(Tuner_IF_Adr,W1_Data,W2_Data,
W3_Data,W4_Data,
W5_Data,W6_Data,
W7_Data,W8_Data,
W9_Data,W10_Data )==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
return;
}
}
//---------------------------------------------------------------------------




void __fastcall TForm1::CE6353Click(TObject *Sender)
{
Form2->DisplayForm(); //呼叫Form2表單函式
Form2->ShowModal(); //呼叫Form2表單方法
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button1Click(TObject *Sender)
{
/* ------------------------------------
Variables Definitions
------------------------------------ */
// System_Type : 1 ---> FQD1116ME PAL B/G
// System_Type : 2 ---> FQD1116ME PAL D/K
// System_Type : 3 ---> FQD1116ME PAL I
// System_Type : 4 ---> FQD1116ME SECAM L
// System_Type : 5 ---> FQD1116ME SECAM L'
// System_Type : 6 ---> FQD1116ME DVB-T
/***********************************************************************************************
Subject: Main
Function: Main
Parameter: None
Return : None
Remark: 1)Provide variable Tuner programming procedure
2)Support to access CE6353 Channel SNR
3)Support to access CE6353 RF AGC Level (optional)
4)Support to access CE6353 IF AGC Level
5)Support to access CE6353 Pre-Viterbi BER measurement
6)Support to access CE6353 Post-Viterbi BER measurement
7)Provide information on the Frequency Offset at the input of CE6353
***********************************************************************************************/
double Freq;
BYTE PLL_R_Value=0;
bool P_D6;
AnsiString buf;
// double Freq_Index;
//unsigned char BW;
// float xdata SNR_Value;
//int xdata RF_Level, Total_Level;
//float xdata Pre_Viterbi_BER, Post_Viterbi_BER;
//float xdata Freq_Offset;
//Set desire channel frequency and bandwidth here to program both FQD1116ME and CE6353/CE6353 !
//Freq = 666;
// BW = 8;


// Setting Freq Selection
Freq=Freq_ComboBox->Text.ToDouble();

// Open Parellel port
if( g_TIIC.IIC_Open() == false )
{
Memo->Font->Color = clRed;
Memo->Lines->Add( "Can't Access Parellel Port, Please Check PC setting" );

}
//Initialize CE6353
//CE6353_Power_On_Initialization();
g_T6353.CE6353_Power_On_Initialization();


if (System_Type == 1) //PAL B/G
{
// Save Tuner IF buffer ===================================================================
IF_buffer[0]=0x38;IF_buffer[1]=0xB1;IF_buffer[2]=0x4C;IF_buffer[3]=0x67;IF_buffer[4]=0x40;
IF_buffer[5]=0x80;IF_buffer[6]=0x0C;IF_buffer[7]=0x00;IF_buffer[8]=0x19;IF_buffer[2]=0x00;
//=========================================================================================
if(Freq <45.25 || Freq>858.5)
{
MessageBox(NULL, "45.25M to 858.25M","ERROR",MB_OK);
Freq_ComboBox->SetFocus();
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);
//Initial FQD1116ME IF part with B/G mode
if(g_T1116.FQD1116ME_IF_Part_Initial(Tuner_IF_Adr,0x38, 0xB1, 0x4C, 0x67, 0x40, 0x80, 0x0C, 0x00, 0x19, 0x00)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}

//Set the frequency of NXP's FQD1116ME Tuner
if(g_T1116.FQD1116ME_SetRF(Tuner_Adr,Freq, 0,Tuner_buffer)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
// CE6353 I2C passthrough disconnector
g_T6353.CE6353_I2C_PassThrough_Setting(0) ;

}
else if (System_Type == 2) //PAL D/K
{
// Save Tuner IF buffer ===================================================================
IF_buffer[0]=0x78;IF_buffer[1]=0xB1;IF_buffer[2]=0x4C;IF_buffer[3]=0x67;IF_buffer[4]=0xC0;
IF_buffer[5]=0x80;IF_buffer[6]=0x0C;IF_buffer[7]=0x00;IF_buffer[8]=0x19;IF_buffer[2]=0x00;
//===========================================================================================
if(Freq <45.25 || Freq>858.5)
{
MessageBox(NULL, "45.25M to 858.25M","ERROR",MB_OK);
Freq_ComboBox->SetFocus();
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);
//Initial FQD1116ME IF part with D/K mode
if(g_T1116.FQD1116ME_IF_Part_Initial(Tuner_IF_Adr,0x78, 0xB1, 0x4C, 0x67, 0xC0, 0x80, 0x0C, 0x00, 0x19, 0x00)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
if(g_T1116.FQD1116ME_SetRF(Tuner_Adr,Freq, 1,Tuner_buffer)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
// CE6353 I2C passthrough disconnector
g_T6353.CE6353_I2C_PassThrough_Setting(0) ;
}
else if (System_Type == 3) //PAL I
{
// Save Tuner IF buffer ===================================================================
IF_buffer[0]=0x58;IF_buffer[1]=0xB1;IF_buffer[2]=0xCC;IF_buffer[3]=0x67;IF_buffer[4]=0x80;
IF_buffer[5]=0x80;IF_buffer[6]=0x0C;IF_buffer[7]=0x00;IF_buffer[8]=0x19;IF_buffer[2]=0x00;
//============================================================================================
if(Freq <45.25 || Freq>858.5)
{
MessageBox(NULL, "45.25M to 858.25M","ERROR",MB_OK);
Freq_ComboBox->SetFocus();
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);
//Initial FQD1116ME IF part with I mode
if(g_T1116.FQD1116ME_IF_Part_Initial(Tuner_IF_Adr,0x58, 0xB1, 0xCC, 0x67, 0x80, 0x80, 0x0C, 0x00, 0x19, 0x00)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
//Set the frequency of NXP's FQD1116ME Tuner
if(g_T1116.FQD1116ME_SetRF(Tuner_Adr,Freq, 2,Tuner_buffer)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
// CE6353 I2C passthrough disconnector
g_T6353.CE6353_I2C_PassThrough_Setting(0) ;
}
else if (System_Type == 4) //SECAM L
{
// Save Tuner IF buffer ===================================================================
IF_buffer[0]=0x79;IF_buffer[1]=0x37;IF_buffer[2]=0x00;IF_buffer[3]=0x67;IF_buffer[4]=0xC0;
IF_buffer[5]=0xC0;IF_buffer[6]=0x0C;IF_buffer[7]=0x00;IF_buffer[8]=0x00;IF_buffer[2]=0x16;
//=========================================================================================
if(Freq <45.25 || Freq>858.5)
{
MessageBox(NULL, "45.25M to 858.25M","ERROR",MB_OK);
Freq_ComboBox->SetFocus();
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);
//Initial FQD1116ME IF part with L mode
if(g_T1116.FQD1116ME_IF_Part_Initial(Tuner_IF_Adr,0x79, 0x37, 0x00, 0x67, 0xC0, 0xC0, 0x0C, 0x00, 0x00, 0x16)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
//Set the frequency of NXP's FQD1116ME Tuner
if(g_T1116.FQD1116ME_SetRF(Tuner_Adr,Freq, 3,Tuner_buffer)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
// CE6353 I2C passthrough disconnector
g_T6353.CE6353_I2C_PassThrough_Setting(0) ;
}
else if (System_Type == 5) //SECAM L'
{
// Save Tuner IF buffer ===================================================================
IF_buffer[0]=0x79;IF_buffer[1]=0x7F;IF_buffer[2]=0x00;IF_buffer[3]=0x60;IF_buffer[4]=0xC0;
IF_buffer[5]=0xC0;IF_buffer[6]=0x0C;IF_buffer[7]=0x00;IF_buffer[8]=0x00;IF_buffer[2]=0x16;
//=========================================================================================
if(Freq <45.25 || Freq>858.5)
{
MessageBox(NULL, "45.25M to 858.25M","ERROR",MB_OK);
Freq_ComboBox->SetFocus();
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);
//Initial FQD1116ME IF part with L' mode
if(g_T1116.FQD1116ME_IF_Part_Initial(Tuner_IF_Adr,0x79, 0x7F, 0x00, 0x60, 0xC0, 0xC0, 0x0C, 0x00, 0x00, 0x16)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
//Set the frequency of NXP's FQD1116ME Tuner
if(g_T1116.FQD1116ME_SetRF(Tuner_Adr,Freq, 4,Tuner_buffer)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
// CE6353 I2C passthrough disconnector
g_T6353.CE6353_I2C_PassThrough_Setting(0) ;
}
else if (System_Type == 6) //DVB-T
{
// Save Tuner IF buffer ===================================================================
IF_buffer[0]=0x00;IF_buffer[1]=0x00;IF_buffer[2]=0x00;IF_buffer[3]=0x67;IF_buffer[4]=0x1F;
IF_buffer[5]=0x01;IF_buffer[6]=0x00;IF_buffer[7]=0x00;IF_buffer[8]=0x00;IF_buffer[2]=0x00;
//=========================================================================================
if(Freq <51 || Freq>858)
{
MessageBox(NULL, "51M to 858M","ERROR",MB_OK);
Freq_ComboBox->SetFocus();
return;
}
// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);
//Initial FQD1116ME IF part with DVB-T mode,Direct IF
if(g_T1116.FQD1116ME_IF_Part_Initial(Tuner_IF_Adr,0x00, 0x00, 0x00, 0x67, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
//Set the frequency of NXP's FQD1116ME Tuner
if(g_T1116.FQD1116ME_SetRF(Tuner_Adr,Freq, 5,Tuner_buffer)==false)
{
MessageBox(NULL, "I2C failure","ERROR",MB_OK);
//return;
}
// CE6353 I2C passthrough disconnector
g_T6353.CE6353_I2C_PassThrough_Setting(0) ;
//Set CE6353 Bandwidth
//CE6353_BW_Programming(BW);
}
buf=Freq;
buf="Tuner programming to " buf " MHZ";
Memo->Lines->Add(buf);


ADB_Edit->Text="0x" IntToHex(Tuner_Adr,2);
DB1_Edit->Text="0x" IntToHex(Tuner_buffer[0],2);
DB2_Edit->Text="0x" IntToHex(Tuner_buffer[1],2);
CB1_Edit->Text="0x" IntToHex(Tuner_buffer[2],2);
CB2_Edit->Text="0x" IntToHex(Tuner_buffer[3],2);
W1_Edit->Text="0x" IntToHex(IF_buffer[0],2);
W2_Edit->Text="0x" IntToHex(IF_buffer[1],2);
W3_Edit->Text="0x" IntToHex(IF_buffer[2],2);
W4_Edit->Text="0x" IntToHex(IF_buffer[3],2);
W5_Edit->Text="0x" IntToHex(IF_buffer[4],2);
W6_Edit->Text="0x" IntToHex(IF_buffer[5],2);
W7_Edit->Text="0x" IntToHex(IF_buffer[6],2);
W8_Edit->Text="0x" IntToHex(IF_buffer[7],2);
W9_Edit->Text="0x" IntToHex(IF_buffer[8],2);
W10_Edit->Text="0x" IntToHex(IF_buffer[9],2);

// Initial CE6353 IIC Pass Through
g_T6353.CE6353_I2C_PassThrough_Setting(1);
g_T1116.FQD1116ME_Tuner_Part_ReadByte(Tuner_Adr,&PLL_R_Value) ; //IIC_Read byte
// CE6353 I2C passthrough disconnector
g_T6353.CE6353_I2C_PassThrough_Setting(0) ;
//POLL Read Mode
P_D6 = (PLL_R_Value & 0x40) ? 1:0;
if(P_D6>0)
{Tuner_LockLabel->Caption="Tuner Lock";
Tuner_LockEdit->Color=clLime;
}
else
{
Tuner_LockLabel->Caption="Tuner Unlock";
Tuner_LockEdit->Color=clRed;
}







Sleep(10);
// Disable Parellel port
// g_TIIC.IIC_Close();

}
//---------------------------------------------------------------------------




void __fastcall TForm1::Clear_ButtonClick(TObject *Sender)
{
Memo->Lines->Clear();
}

===============================================
Form2 的程式


#include
#pragma hdrstop
#include "CE6353_Unit2.h"
#include "main.h"
#include "6353.h"
#include "IIC.h"
#include "FQD1116.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#define CE6353_devAddr 0x1E

#pragma resource "*.dfm"
TForm2 *Form2;

//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::DisplayForm(void)
{

}
void __fastcall TForm2::CE6353_Write_ByteButtonClick(TObject *Sender)
{
WORD adr;
BYTE value;
BYTE bAdrIndex;
adr=Address_Edit->Text.ToInt();

bAdrIndex = (BYTE)adr;
Address_Edit->Text=bAdrIndex;
// Open Parellel port
if( g_TIIC.IIC_Open() == false )
{
//Memo->Font->Color = clRed;
//Memo->Lines->Add( "Can't Access Parellel Port, Please Check PC setting" );
//return;
}
value=Write_Edit->Text.ToInt();
if(g_TIIC.IIC_WriteByte( CE6353_devAddr,bAdrIndex,value ) == false)
{
//Memo->Lines->Clear();
//Memo->Font->Color = clRed;
//Memo->Lines->Add( "Can't write IIC" );
}
Sleep( 10 ); //delay 10 mS
// Disable Parellel port
g_TIIC.IIC_Close();
}
//---------------------------------------------------------------------------



teddy470
一般會員


發表:2
回覆:1
積分:0
註冊:2008-09-02

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-09-13 22:20:10 IP:61.59.xxx.xxx 訂閱
此問題我以解決,不用回覆了..Thanks
系統時間:2024-04-20 0:18:04
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!