Télécharger Imprimer la page

Lumen Dynamics Group OmniCure S2000 Mode D'emploi page 47

Publicité

S2000 MODE D'EMPLOI
16.7 Exemple de code :
Exemple – Programmation Borland C++ pour la commande «GLG» –
Demande du diamètre du conducteur de lumière
void __fastcall TForm1::Cmd33Click(TObject *Sender)
{
signed char Tries = 4;
float LG_diameter;
unsigned char
*Command;
String
Textcom= "GLG";
int
Command_CRC;
Timer1->Enabled = false;
Cmd33->Enabled = false;
Command = Textcom.c_str();
Command_CRC = CalcCRC8(0, Command, 3); // Calculate CRC8 for the
command "GLG"
Screen->Cursor = crHourGlass;
Application->ProcessMessages();
while (Tries--)
{
ComPort->FlushInBuffer();
ComPort->FlushOutBuffer();
ComPort->PutString(Textcom);
ComPort->PutChar(Asc[Command_CRC>>4]);
string
ComPort->PutChar(Asc[Command_CRC & (0xF)]);
string
ComPort->PutChar('\r');
a=0;
UnitResponse = "";
TimeOut = false;
TimeOutTimer = 1;
while (TimeOutTimer) Application->ProcessMessages();
if (a == '\r')
{
a = 0;
// Show hourglass cursor
// send the command "GLG"
// send the CRC8 in hex
// send the CRC8 in hex
- 42 –

Publicité

loading