Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "Message.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- if (serie1.OpenOk("COM6")==1) ShowMessage("Ok");
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button2Click(TObject *Sender)
- {
- serie1.Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button4Click(TObject *Sender)
- {
- AnsiString Phrase;
- Phrase=Edit2->Text;
- int taille = Phrase.Length();
- char tabPhrase[256];
- strcpy(tabPhrase,Phrase.c_str());
- unsigned char tabBuffer[256];
- tabBuffer[0]= 0x00;
- tabBuffer[1]= 0x00;
- tabBuffer[2]= 0x00;
- tabBuffer[3]= 0x00;
- tabBuffer[4]= 0x00;
- tabBuffer[5]= 1;
- tabBuffer[6]= 'z' ;
- tabBuffer[7]= '0';
- tabBuffer[8]= '0';
- tabBuffer[9]= 2;
- tabBuffer[10]= 'A';
- tabBuffer[11]= 'A';
- for (int i=0; i<taille; i++){
- tabBuffer[12+i]= tabPhrase[i]; }
- tabBuffer[12+taille] = 4;
- serie1.Transmit(tabBuffer, taille+13);
- Sleep(100);
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button3Click(TObject *Sender)
- {
- {
- serie1.SetProtocol(ComboBox1->Text.ToInt(),ComboBox2->Text.ToInt(),ComboBox4->ItemIndex, ComboBox3->ItemIndex);
- }
- }
- //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement