📄 loop3.cpp
字号:
// Form7->EC67->Text="0";
}
break;
case 6:
Form7->EA77->Text=IntToStr(AxleGr[i].Aweigh);
tempo=AxleGr[i].Aweigh;
switch(AxleGr[i].Atype)
{
case 1:
Form7->EL77->Text=IntToStr(limit6);
tempo-=limit6;
break;
case 2:
Form7->EL77->Text=IntToStr(limit10);
tempo-=limit10;
break;
case 4:
Form7->EL77->Text=IntToStr(limit18);
tempo-=limit18;
break;
case 6:
Form7->EL77->Text=IntToStr(limit22);
tempo-=limit22;
}
if(tempo>0)
{
ov=1;
// Form7->EC77->Text=IntToStr(tempo);
}
else
{
// Form7->EC77->Text="0";
}
break;
case 7:
Form7->EA87->Text=IntToStr(AxleGr[i].Aweigh);
tempo=AxleGr[i].Aweigh;
switch(AxleGr[i].Atype)
{
case 1:
Form7->EL87->Text=IntToStr(limit6);
tempo-=limit6;
break;
case 2:
Form7->EL87->Text=IntToStr(limit10);
tempo-=limit10;
break;
case 4:
Form7->EL87->Text=IntToStr(limit18);
tempo-=limit18;
break;
case 6:
Form7->EL87->Text=IntToStr(limit22);
tempo-=limit22;
}
if(tempo>0)
{
ov=1;
// Form7->EC87->Text=IntToStr(tempo);
}
else
{
// Form7->EC87->Text="0";
}
break;
} //for switch i;
} //for the group for
//计算轴序
Form7->EL17->Text=Ax;
//for the leiji
int temlei=0;
spic+=".bmp";
try{
// Image1->Picture->LoadFromFile(spic);
Form7->Image1->Picture->LoadFromFile(spic);
}
catch(...)
{
ShowMessage("对不起!没有此车型图片.");
}
err_code=-1;
//second insert the datas to the tables;
UserMod->Tinsert->Open();
UserMod->Tinsert->Insert();
UserMod->Tinsert->FieldByName("VEHNO")->AsInteger=UserMod->Tinsert->RecordCount+1;
UserMod->Tinsert->FieldByName("DATETIME")->AsDateTime=Now();
UserMod->Tinsert->FieldByName("VEHDATA")->AsString=ss;
UserMod->Tinsert->FieldByName("ALLWEIGH")->AsInteger=total_weigh;
UserMod->Tinsert->Post();
UserMod->Tinsert->Close();
UserMod->Tdisplay->Close();
UserMod->Tdisplay->Open();
UserMod->Tdisplay->Last();
} //for receive data;for 0xca 0x11;
} //for 0xaa;
}//for if 0x55
if(err_code<0)
{
// Form7->Label13->Caption="车辆可能行使太快";
break;
}
} //for while(1);
}//for code_err==0 */
}
//---------------------------------------------------------------------------
__fastcall TForm3::dmode()
{ int limp,ret,help,len,err_code1;
unsigned char temp[6];
unsigned char ibuf[6];
err_code1=0;
help=0x00;
temp[0]=0x55;
help=help-0x55;
temp[1]=0xc4;
help=help-0xc4;
temp[2]=0x01;
help=help-0x01;
temp[3]=0x00;
help=help-0x00;
temp[4]=0xaa;
help=help-0xaa;
temp[5]=help;
len = sio_write( com1, temp, 6);
if (len!=6)
{
ShowMessage("err_code=c06");
err_code1=-29;
};
limp=0;
do
{
limp++;
Sleep(30);
if (err_code1<0) break;
ret = sio_iqueue ( com1 );
if(limp>100)
{
err_code1=-22;
};
}while(ret<6);
if(err_code1==0)
{
sio_read (com1,ibuf, 6); // 接 收 数 据
if(((ibuf[0]&0xff)==0x55)&((ibuf[1]&0xff)==0xc4)&((ibuf[2]&0xff)==0x20)&((ibuf[3]&0xff)==0x00)&((ibuf[4]&0xff)==0xaa)&((ibuf[5]&0xff)==0x1d))
err_code1=0;
else
err_code1=-23;
}
return err_code1;
}
void __fastcall TForm3::FormShow(TObject *Sender)
{
//设置动态模式
Sleep(100);
DynMode();
/*int len,limp,tele_ok;
char temp[6],help,ibuf[6];
help=0x00;
temp[0]=0x55;
help=help-0x55;
temp[1]=0x04;
help=help-0x04;
temp[2]=0x02;
help=help-0x02;
temp[3]=0x00;
help=help-0x00;
temp[4]=0xaa;
help=help-0xaa;
temp[5]=help;
ret = sio_flush ( com1, 2 );
if (ret != SIO_OK)
{
ShowMessage("err_code=c203");
};
limp=0;
do
{
limp++;
ret=dmode1();
if(limp>5)
break;
}
while(ret!=0);
if(ret!=0)
ShowMessage("称重设置失败,请检查硬件后再启动。");
int err_code ;
ret=sio_flush ( com1, 2 );
if(ret != SIO_OK)
{
ShowMessage("err_code=c203");
}; */
}
//---------------------------------------------------------------------------
void __fastcall TForm3::Button2Click(TObject *Sender)
{
disweighdata();
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -