初级会员
- 积分
- 165
- 金钱
- 165
- 注册时间
- 2015-10-6
- 在线时间
- 25 小时
|
50金钱
data_CountFL=CC1.MNum+20; //é¨Ãèμãêy
AD5933_FreInit( CC1.Fre , CC1.PlusFre );
Range = AD5933_SetRange();
AD5933_SelfTest( Range , &SelfT ); //×Ô2a
Switch_Config( 1 , Range ); //¿a·′à¡
AD5933_StartTest( 0 );
AD5933_ReadImpedance( &OutT );
QP(); //ÇåÆá
Temp = ((float)SelfT.Impedance/OutT.Impedance*Range);
if( (OutT.Phase-SelfT.Phase)<=0 )
{
TempPhase = ( ((float)(OutT.Phase-SelfT.Phase)) );
}
else
{
TempPhase = ((float)(OutT.Phase-SelfT.Phase));
}
LCD_WriteString( 1,0,"Imped:");
if( Temp-ConstR<0 )
{
LCD_WriteFloat(1,7, 0);
}
else
{
LCD_WriteFloat(1,7, Temp-ConstR);
}
LCD_WriteString( 2,0,"hase:");
LCD_WriteFloat(2,7,TempPhase);
}
EA = 1;
}
if( Rx_OK==1 ) //½øèëC¿ØÖÆ2aá¿×′ì¬
{
if( Check_And0(UART_Rx_Buffer,Max_Rx)==0 ) //èç1ûD£Ñéoí==0¾íÆô¶ˉ½aÎöêy×é
{
QP();
LCD_WriteString(2,0,"RECEIVE OK!");
for( i=0 ; i<3 ;i++) //»ñè¡·¢éäμØÖ·
{
UART_Tx_Buffer[i] = UART_Rx_Buffer[i+3];
}
CC1.MNum = UART_Rx_Buffer[11];
CC1.Fre = (uint)(UART_Rx_Buffer[7])*256+(uint)(UART_Rx_Buffer[8]); //ÆμÂê
CC1.PlusFre = (uint)(UART_Rx_Buffer[9])*256+(uint)(UART_Rx_Buffer[10]); //ÆμÂêÔöá¿
CC1.Sp = UART_Rx_Buffer[12] -10;
CC1.Voltage = UART_Rx_Buffer[13];
AD5933_TestToPC(); //¿aê¼2aêÔ
Add_And0( UART_Tx_Buffer , 8*CC1.MNum+7 );
EA = 0;
UART_WriteTable( UART_Tx_Buffer , 8*CC1.MNum+8 );
EA = 1;
Rx_OK=0;
UART_IT(1);
}
else
{
QP();
LCD_WriteString(2,0,"RECEIVE Error;");
Rx_OK=0;
UART_IT(1);
}
}
}
return 0;
}
void AD5933_TestToPC( void ) //2aêÔò»′Î×°ÔØμ½·¢éä»o3å
{
uchar i;
float Range; //3õ′Îá¿3ì ÔY′æ
unsigned long Temp;
unsigned long TempPhase;
switch( CC1.Voltage ) //¼¤àø·å·åÖμ£o0.2Vpp:0x02 0.4Vpp:0x04 1Vpp:0x06 2Vpp:0x00
{
case 1: data_Vpp=0x02;break;
case 2: data_Vpp=0x04;break;
case 3: data_Vpp=0x06;break;
case 4: data_Vpp=0x00;break;
}
data_CountFL = CC1.MNum+20; //é¨Ãèμãêy
AD5933_FreInit( CC1.Fre , CC1.PlusFre ); //AD5933Ïμí33õê¼»ˉ
Range = AD5933_SetRange(); //½øDDá¿3ì2aêÔ
AD5933_SelfTest( Range , &SelfT ); //×Ô2a
Switch_Config( 1 , Range ); //¿a·′à¡
Delay_Ms( 100 );
CJ_Long( UART_Tx_Buffer , 3 , ConstR*100 );
AD5933_StartTest( 0 );
AD5933_ReadImpedance( &OutT );
LCD_WriteFloat(1,0,Range);
Temp = (unsigned long )((float)SelfT.Impedance/OutT.Impedance*Range*100.0);
if( (OutT.Phase-SelfT.Phase)<=0 )
{
TempPhase = (unsigned long )( 800000 + ((float)(OutT.Phase-SelfT.Phase)*100000.0) );
}
else
{
TempPhase = (unsigned long )((float)(OutT.Phase-SelfT.Phase)*100000.0);
}
CJ_Long( UART_Tx_Buffer , 7 , Temp ); //×è¿1
CJ_Long( UART_Tx_Buffer , 11 , TempPhase ); //Ïàλ
for( i=0 ; i<CC1.MNum-1 ; i++ )
{
Switch_Config( 1 , Range+1 ); //¿a·′à¡
Delay_Ms(50);
AD5933_StartTest( CC1.Sp );
AD5933_ReadImpedance( &OutT );
AD5933_SelfTest( Range , &SelfT ); //×Ô2a
Temp = (unsigned long )((float)SelfT.Impedance/OutT.Impedance*Range*100.0);
if( (OutT.Phase-SelfT.Phase)<0 )
{
TempPhase = (unsigned long )( 800000 + ((float)(OutT.Phase-SelfT.Phase)*100000.0) );
}
else
{
TempPhase = (unsigned long )((float)(OutT.Phase-SelfT.Phase)*100000.0);
}
CJ_Long( UART_Tx_Buffer , 15+8*i , Temp ); //×è¿1
CJ_Long( UART_Tx_Buffer , 15+4+8*i , TempPhase ); //Ïàλ
}
}
|
|