Application.Title = "Temper_12F1840_DS18B20_HC06" ' test avec simule_DS18B20_181213.tsc ' Grafique deroulant ...OK derniere mesure à droite du graphe $Apptype GUI Application.Title = "Mesure Temperature via BlueToot" Const Version= "13-12-2018 (Win10)" $TYPECHECK ON $OPTIMIZE ON '$Include "QLed.inc" $Include "inc\Rapidq.inc" $INCLUDE "inc\MyQChart.inc" '$INCLUDE $option Icon "ico\RobJer.ico" ' format 32x32 ' trame emise par PIC12F1840+ HC06 (esclave) ' reçue coté PC par cle USB/BT APM (maitre) '*j00040;*T18.437 ' cette syntaxe de trame pour etre compatible avec appli Android BlueElectronics 'fichier *.ini pour setup COM '177 ' Top window '1237 ' left Window '4 ' 19200 bds '0 ' NO parity '1 ' Nb datas 8 '0 ' 1 stop '2 ' COM3 Declare Function SetFocus Lib "user32"Alias "SetFocus" (ByVal hwnd As Long) As Long Declare Function GetFocus LIB "user32" alias "GetFocus" () as Long Declare Function OPENCOM Lib "Dll\RSCOM.dll" alias "OPENCOM"(ByVal OpenString$) As Integer 'ouvre le port Declare Sub CLOSECOM Lib "Dll\RSCOM.dll"alias "CLOSECOM" () 'fermer le port com Declare Sub TXD Lib "Dll\RSCOM.dll" alias "TXD" (ByVal b%) 'broche 3 envoie, Emission de données Declare Sub DTR Lib "Dll\RSCOM.dll" alias "DTR" (ByVal b%) 'broche 4 envoie, Terminal prêt. Declare Sub RTS Lib "Dll\RSCOM.dll" alias "RTS" (ByVal b%) 'broche 7 envoie, Demande d'emmission Declare Function DCD Lib "Dll\RSCOM.dll" alias "DCD" As Integer 'broche 1 lecture, Dectection de porteuse Declare Function DSR Lib "Dll\RSCOM.dll" alias "DSR" As Integer 'broche 6 lecture, Emmission prête Declare Function CTS Lib "Dll\RSCOM.dll" alias "CTS" As Integer 'broche 8 lecture, Prêt à emettre Declare Function RI Lib "Dll\RSCOM.dll" alias "RI" As Integer 'broche 9 lecture, Indicateur de sonnerie Declare Sub CLEARBUFFER Lib "Dll\RSCOM.dll" alias "CLEARBUFFER"() 'Nettoye le buffer en entrée Declare Function INBUFFER Lib "Dll\RSCOM.dll" alias "INBUFFER" () As Integer 'Nombre de caractère dans le buffer d'entré Declare Function OUTBUFFER Lib "Dll\RSCOM.dll" alias "OUTBUFFER" () As Integer'Nombre de caractère dans le buffer de sortie ? Declare Sub BUFFERSIZE Lib "Dll\RSCOM.dll" alias "BUFFERSIZE" (ByVal b%) 'Change la taille du buffer Taille du buffer Declare Sub DELAY Lib "Dll\RSCOM.dll" alias "DELAY" (ByVal ms As Double) 'delai en micro seconde // duree d'un bit Declare Function INPUTS Lib "Dll\RSCOM.dll" alias "INPUTS" () As Integer '? Declare Sub REALTIME Lib "Dll\RSCOM.dll" alias "REALTIME" () '? Declare Function READSTRING Lib "Dll\RSCOM.dll" alias "READSTRING" () As String 'Relire une chaine Declare Function READBYTE Lib "Dll\RSCOM.dll" alias "READBYTE" As Integer 'Lire un caratère Declare Sub NORMALTIME Lib "Dll\RSCOM.dll" alias "NORMALTIME" () Declare Sub SENDBYTE Lib "Dll\RSCOM.dll" alias "SENDBYTE" (ByVal Dat%) 'Envoyer un caratère Declare Sub SENDSTRING Lib "Dll\RSCOM.dll" Alias "SENDSTRING" (ByVal Dat$)'Envoyer une chaine Declare Sub TIMEINIT Lib "Dll\RSCOM.dll" alias "TIMEINIT" () 'Reinit le temps Declare Sub TIMEOUTS Lib "Dll\RSCOM.dll" alias "TIMEOUTS" (ByVal b%) 'depassement du temps ? 'Declare Function TIMEREAD Lib "Dll\RSCOM.dll" alias "TIMEREAD" () As Double 'donne le temps d'ouverture du port ? Declare sub Activer_Port_COM() Declare Function Trim(Datum As String) As String Declare Function JourSemaine() AS INTEGER Declare Sub Initialise() Declare sub Message(Situation as single) Declare Sub Temper_BTShow(Sender as QForm) Declare Sub Temper_BTClose(Action AS INTEGER) ' 4 boutons Declare Sub SortieClick(Sender as QButton) Declare Sub RAZ_ReceptionClick(Sender as QButton) ' choix parametre COM Declare Sub Port_Combo1Change(Sender as QComboBox) Declare Sub Speed_Combo2Change(Sender as QComboBox) Declare Sub Parity_Combo3Change(Sender as QComboBox) Declare Sub Nb_Datas_Combo4Change(Sender as QComboBox) Declare Sub Nb_StopChange(Sender as QComboBox) Declare SUB Read_COMx() Declare SUB TimerOver() Declare Sub Indice_CompteurClick(Sender as QLabel) '================ Declare Sub Temper_BTResize (SENDER As QFORM) declare Sub DrawOrig() Declare Sub Initialise() Declare Sub Save_Temper_to_File Dim String_Comm As String ' DIM Information AS STRING Dim Variable$ Dim x as integer Dim infoCom As Integer Dim Com as string Dim Baud as string Dim Parite as string Dim Nb_Datas as string dim Nb_Stop as string Dim Chemin as string Dim Deja as single Dim Fichier as QFilestream Dim Nombre as integer Dim A$ as string ' Dim B1$ as string DIM C$ as string dim Nbytes as integer dim Jt as integer ' Timer1 count DIM dd$ as string DIM DOW$ as string Dim JourSem as integer Dim mm as integer Dim dd as integer Dim yy as integer DIM i as integer Dim j as integer Dim k as integer Dim L1 as long dim L2 as integer Dim Trame_Temper$ as String Dim IndiceCompteur$ as string Dim Table(600) as single dim HH as integer dim Mn as integer dim ss as integer dim Nb_Trame as integer dim Old_Nb_Mn as integer dim Nb_Mn as integer ' dim simulation as integer Dim TemperAmb1 as single Dim Temper_Moyen as single Dim Moyenne_Jour as single Const MB_NOFOCUS = &H8000& Const Logiciel = "Temper_BT" Const Vir = "Temper_BT.vir" Const Exe = "Temper_BT.exe" Const Ini = "Temper_BT.ini" ' Const SaveAmps="SaveAmps.txt" const TIMEOUT_Trame=100 ' Const Son = "Son\Alerte.wav" DEFINT maxV = 6001 DIM xdata(0 TO maxV) AS SINGLE DIM ydata(0 TO maxV) AS SINGLE DIM tdata(0 TO maxV) AS SINGLE DIM th AS SINGLE DIM n AS INTEGER DEFINT maxc = 10 'max columns DEFINT maxr = 20 'max rows DIM myTime AS SINGLE Dim Index_Chart as Integer ' 1 journéee de stockage Dim Temper_Store(1441) as single Dim Once as integer Dim Drapeau_Save as integer Declare Sub CoolBtn2Click(Sender as QCoolBtn) Create Temper_BT as QForm Caption = "Temper_BT" Top = 83 Left = 82 Width = 1000 Height = 800 OnShow = Temper_BTShow OnClose = Temper_BTClose BorderStyle = 1 DelBorderIcons = 2 Icon = "D:\RapidQ\icon\mylogo.ico" ShowHint = True END CREATE Create Graph1 As QCHART 'Create a copy of the new object Top =190 : Left =10 Height=500 Width=900 OnPaint = Graph1.PaintChart 'This line REQUIRED to process Repaints End Create' Graph1 Create Groupe1 as QGroupBox Parent = Temper_BT Top = 48 Left = 8 Width = 257 Height = 57 Caption = "Port de communication inconnu" Color = -2147483648 End Create Create Sortie as QButton Parent = Groupe1 Top = 18 Left = 18 Width = 141 Height = 32 Caption = "Sortie" OnClick = SortieClick Align = alNone Font.Name = "MS Sans Serif" Font.Color = -2147483640 Font.Size = 8 Font.AddStyles fsBold End Create ' COM Setup Create Port_Combo1 as QComboBox Parent = Temper_BT Top = 16 Left = 16 Width = 81 Height = 22 Text = "" Color = &HFFFFFF Font.Name = "MS Sans Serif" Font.Color = -2147483640 Font.Size = 10 AddItems "Com1","Com2","Com3","Com4","Com5","Com6",_ "Com7","Com8","Com9","Com10","Com11","Com12","Com13",_ "Com14","Com15","Com16","Com17","Com18","Com19","Com20",_ "Com21","Com22","Com23","Com24","Com25","Com26","Com27" OnChange = Port_Combo1Change Style = csOwnerDrawFixed End Create Create Speed_Combo2 as QComboBox Parent = Temper_BT Top = 16 Left = 104 Width = 65 Height = 22 Text = "" Color = &HFFFFFF AddItems "1200",_ "2400",_ "4800",_ "9600",_ "19200",_ "38400",_ "57600",_ "115200" OnChange = Speed_Combo2Change Style = csOwnerDrawFixed Font.Name = "MS Sans Serif" Font.Color = -2147483640 Font.Size = 10 End Create Create Parity_Combo3 as QComboBox Parent = Temper_BT Top = 16 Left = 176 Width = 41 Height = 22 Text = "" Color = &HFFFFFF Style = csOwnerDrawFixed AddItems "N",_ "O",_ "E",_ "M',_ 'S" Font.Name = "MS Sans Serif" Font.Color = -2147483640 Font.Size = 10 OnChange = Parity_Combo3Change End Create Create Nb_Datas_Combo4 as QComboBox Parent = Temper_BT Top = 16 Left = 224 Width = 41 Height = 22 Text = "" Color = &HFFFFFF Font.Name = "MS Sans Serif" Font.Color = -2147483640 Font.Size = 10 Style = csOwnerDrawFixed AddItems ("7","8","9") OnChange = Nb_Datas_Combo4Change End Create Create Nb_Stop_Combo5 as QComboBox Parent = Temper_BT Top = 16 Left = 272 Width = 49 Height = 22 Text = "" Color = &HFFFFFF AddItems ("1","1.5","2") Style = csOwnerDrawFixed Font.Name = "MS Sans Serif" Font.Color = -2147483640 Font.Size = 10 OnChange = Nb_StopChange End Create Create Label1 as QLabel Parent = Temper_BT Top = 8 Left = 416 Width = 76 Height = 13 Caption = "Time elapsed" Color = &HF0F0F0 Font.Name = "MS Sans Serif" Font.Color = -2147483640 Font.Size = 8 Font.AddStyles fsBold End Create Create Timer1 as QTimer Enabled = False Interval = 1000 End Create Create StatusBar1 as QStatusBar Parent = Temper_BT Top = 399 Left = 0 Width = 898 Height = 33 SimpleText = "Receive Status bar" SimplePanel = True SizeGrip = True End Create Create Zone_Reception as QRichEdit Parent = Temper_BT Top = 144 Left = 8 Width = 601 Height = 33 Color = -2147483624 ' OnChange = Zone_ReceptionChange PlainText = True ScrollBars = ssVertical HideScrollBars = False ReadOnly = False ShowHint = True Font.Name = "MS Sans Serif" Font.Color = 16711680 Font.Size = 8 End Create Create RX_Gauge1 as QGauge Parent = Temper_BT Top = 112 Left = 8 Width = 201 Height = 25 Color = &HF0F0F0 Max = 128 Position = 64 ForeColor = 16711680 End Create Create DateEnCours as QLabel Parent = Temper_BT Top = 8 Left = 616 Width = 23 Height = 13 Caption = "Date" Color = &HF0F0F0 End Create Create TimeEnCours as QLabel Parent = Temper_BT Top = 8 Left = 712 Width = 23 Height = 13 Caption = "Time" Color = &HF0F0F0 End Create Create Label7_wod as QLabel Parent = Temper_BT Top = 8 Left = 544 Width = 25 Height = 13 Caption = "WoD" Color = 16777215 AutoSize = False End Create Create RAZ_Reception as QButton Parent = Temper_BT Top = 112 Left = 224 Width = 105 Height = 25 Caption = "RAZ_Reception" OnClick = RAZ_ReceptionClick End Create Create GroupBox2 as QGroupBox Parent = Temper_BT Top = 48 Left = 272 Width = 185 Height = 49 Caption = "Indice" Color = &HF0F0F0 End Create Create Indice_Compteur as QLabel Parent = GroupBox2 Top = 14 Left = 10 Width = 134 Height = 24 Caption = "Indice_Compteur" Color = &HF0F0F0 Font.Name = "MS Sans Serif" Font.Color = 0 Font.Size = 14 End Create Create GroupBox7 as QGroupBox Parent = Temper_BT Top = 48 Left = 472 Width = 137 Height = 65 Caption = "Temper.Ambiante Garage" Color = 8421504 End Create Create Tamb_G as QLabel Parent = GroupBox7 Top = 16 Left = 16 Width = 102 Height = 41 Caption = "19.99" Color = 8421504 Font.Name = "Arial" Font.Color = 65280 Font.Size = 26 Font.AddStyles fsBold Alignment = taRightJustify End Create Create CoolBtn1 as QCoolBtn Parent = Temper_BT Top = 224 Left = 1144 Width = 17 Height = 1 Caption = "" End Create Create Label5 as QLabel Parent = Temper_BT Top = 290 Left = 322 Width = 161 Height = 29 Caption = "Sauve Fichier " Color = &HF0F0F0 Transparent = False Enabled = False Visible = False Font.Name = "MS Sans Serif" Font.Color = -2147483640 Font.Size = 18 Font.AddStyles fsBold End Create Sub DrawOrig Dim j As Integer Dim i As Integer 'draw original data set With Graph1 .Initialize 'Set defaults .ChartType = ctXY 'XY Scatter Chart .ChartStyle = csLines 'just Lines, use csBoth for lines and Points .MainTitle.Text = "Temp Ambiante" .XTitle.Text = "Nb Trames" .YTitle.Text = "Temper." .ChartBorder=1 .AxisBorder=True .GridColor=&H00FF00 .PlotAreaColor=&HF0F0F0 .Cols = 1 'Number of series .Rows = n-1 .XAxis.color=.Colors(0) .Series(1).COLOR=.Colors(5) 'Number of data points per series REDIM Graph1.XYData(.Cols,.Rows,2) .DoLegend = false .Series(1).LineWidth = 3 .Series(1).LineStyle=lsSolid .Missing=0 For j = 0 To .Rows .XYData(1,j,1) =j .XYData(1,j,2) =0 next j .AxisBorder=TRUE .XAxis.AutoScale=False .YAxis.AutoScale=False .YAxis.Min = -10.0 .XAxis.Max = n .YAxis.Max = 40.0 .XAxis.Max = n ' 6000 pour ~2H00 .DrawChart (False) 'Draw it! ' End With END SUB Sub Initialise() IndiceCompteur$= "00000" Indice_Compteur.Caption=IndiceCompteur$ TemperAmb1=0.0 Moyenne_Jour=0.0 Trame_Temper$="" Temper_Moyen=0 Nb_Trame=0 Index_Chart=0 TemperAmb1=19.99 Tamb_G.caption="19.99" for i=0 to 600 Table(i)=0 next i for Nb_Mn=0 to 1440 Temper_Store(Nb_Mn)=0 next Nb_Mn Nb_Mn=0 Graph1.ClearAll n=600 Temper_BT.Caption="Temper_BT Version : "+Version Drapeau_Save=0 Once=0 Index_Chart=0 with Label5 .Top =400 .Left = 400 .Width = 300 .Height = 120 .Caption = "Sauve Fichier Data " .Color = &HF0F0F0 .Transparent = False .Enabled = False .visible=False end with end sub SUB TimerOver() dim Iz as integer 'Communication Jt = Jt + 1 Label1.Caption = "Time elapsed = " +STR$(jt) NBytes=INBUFFER() RX_Gauge1.Position= NBytes StatusBar1.simpletext = "Bytes in buffer: " & STR$(NBytes) if ((NBytes>12) and (NBytes <22) )then ' 1 seule trame dans le buffer ! 'Lecture buffer COM Read_COMx() Index_Chart=Index_Chart+1 JourSem=Joursemaine() TimeEnCours.Caption=Time$ dow$=mid$(dd$,(JourSem*3)+1,3) DateEnCours.Caption=str$(dd)+"/"+str$(mm)+"/2018" Label7_wod.caption=Dow$ HH = val(left$(Time$,2)) Mn = val(Mid$(Time$,4,2)) ss = val(right$(Time$,2)) Nb_Mn=HH*60+Mn if (Nb_Mn=0) then Drapeau_Save=0 Temper_Moyen=Temper_Moyen+TemperAmb1 Nb_Trame=Nb_Trame+1 if (Nb_Mn<> Old_Nb_Mn) then Old_Nb_Mn=Nb_Mn if (Nb_Trame>2) Then Temper_Store(Nb_Mn)= Temper_Moyen/Nb_Trame else Temper_Store(Nb_Mn)=0 end if Nb_Trame=0 Temper_Moyen=0 end if ' sauvegarde vers 23H59:57 sec if (Nb_Mn>1438) and (ss>57) and (Drapeau_Save=0) then Save_Temper_to_File Drapeau_Save=1 Nb_Mn=0 end if ' taille à etendre !! if (Index_Chart>598) then Once=1 end if if (Once=1) then with Graph1 Index_Chart=599 .Series(1).COLOR=.Colors(5) for i=1 to 599 Table(i-1)=Table(i) .XYData(1,i-1,2)= Table(i-1) next i Table(599)=TemperAmb1 .XYData(1,599,2)= Table(599) .DrawChart (false) end with else with Graph1 .Series(1).COLOR=.Colors(5) Table(Index_Chart)=TemperAmb1 .XYData(1,Index_Chart,2)= Table(Index_Chart) .DrawChart (false) end with end if else if (jt>30) then Zone_Reception.AddString ("TimeOut reception") jt=0 CLEARBUFFER end if end if END SUB SUB Read_COMx() Dim L0 as integer Dim j as integer DIm i as integer Dim Lg as integer DIm Ax$ as string dim mn$ as string jt=0 Trame_Temper$=ReadString() Lg=len(Trame_Temper$) ' traitement des datas reçues if ( (left$(Trame_Temper$,2)="*j") and (Lg>15) and (lg<21)) then '*j00107;*T 18.875 Zone_Reception.text=left$(Trame_Temper$,18) IndiceCompteur$= Mid$(Trame_Temper$,3,5) Indice_Compteur.caption=IndiceCompteur$ Ax$= Mid$(Trame_Temper$,11,Lg-8) TemperAmb1=val(Ax$) Tamb_G.caption=format$("%3.3f",TemperAmb1) else Ax$="Erreur sur trame "+chr$(13) CLEARBUFFER end if ' Trame_Temper$="" END SUB Temper_BT.ShowModal Sub Temper_BTShow(Sender as QForm) dim A1$ as string BUFFERSIZE(128) ' > à 2x la longueur trame de 103 cars CLEARBUFFER Initialise() Trame_Temper$="" 'n=maxV n=600 ' dimanche=Day week #0 dd$= "DimLunMarMerJeuVenSam" Nombre = 0 Chemin = left$(command$(0), rinstr(command$(0), "\")) IF FILEEXISTS(Chemin + "$$$$$.$$$" ) = 0 and Deja = 0 THEN Fichier.open(Chemin + "$$$$$.$$$" ,fmcreate) Fichier.close Deja = 1 elseif Deja = 0 then messagebox("Le programme est déja chargé ou alors il vous faut _ détruire le fichier $$$$$.$$$ qui se trouve dans le _ meme répertoire.","Achtung!",0) Application.terminate end end if IF FILEEXISTS(Chemin + Ini ) <> 0 THEN Fichier.open(Chemin + Ini, fmopenread) A1$= "Ouverture fichier "+chr$(13)+Chemin + Ini messagebox(A1$,"Init COM",0) DO Nombre = Nombre + 1 Variable$ = trim((fichier.readline())) IF Nombre = 1 AND variable$ <> "" THEN IF VAL(variable$) < 40000 THEN Temper_BT.Top = VAL(variable$) END IF END IF IF Nombre = 2 AND variable$ <> "" THEN IF VAL(variable$) < 40000 THEN Temper_BT.left = VAL(variable$) END IF END IF IF Nombre = 3 AND variable$ <> "" THEN Speed_combo2.ItemIndex = val(Variable$) baud = Speed_combo2.Text end if IF Nombre = 4 AND variable$ <> "" THEN Parity_Combo3.ItemIndex = val(Variable$) Parite = Parity_Combo3.Text end if IF Nombre = 5 AND variable$ <> "" THEN NB_Datas_Combo4.ItemIndex = val(Variable$) Nb_datas = Nb_Datas_Combo4.Text end if IF Nombre = 6 AND variable$ <> "" THEN Nb_Stop_combo5.ItemIndex = val(Variable$) Nb_Stop = Nb_Stop_Combo5.Text end if if Nombre = 7 AND variable$ <> "" THEN Port_Combo1.ItemIndex = val(Variable$) Com = Port_Combo1.Text end if LOOP UNTIL Fichier.Size = Fichier.Position if Com <> "" and Baud <> "" And Parite <> "" and Nb_Datas <> "" and Nb_Stop <> "" then ' tous les parametres setup COM sont present ' donc activer le port COM Activer_Port_COM() Timer1.interval=TIMEOUT_Trame Timer1.Enabled= True Timer1.OnTimer= TimerOver HH = val(left$(Time$,2)) Mn = val(Mid$(Time$,4,2)) ss = val(right$(Time$,2)) Nb_Mn=HH*60+Mn Old_Nb_Mn=Nb_Mn end if Fichier.close Nombre = 0 END IF ' file exist DrawOrig END sub Sub Save_Temper_to_File dim ia as integer dim C$ as string dim TT as long dim FileName$ as string Timer1.enabled=False Filename$="Temper_Data_"+ str$(mm) if dd<10 then Filename$=Filename$=Filename$+"0" Filename$= Filename$+str$(dd)+".txt" IF FILEEXISTS(Chemin + FileName$) = 0 THEN Fichier.open(Chemin +FileName$,fmcreate) Fichier.close end if Moyenne_Jour=0 Fichier.open(Chemin + FileName$,fmopenwrite) C$= Date$+";"+Time$+";" Fichier.writeline(C$) for ia=0 to 1439 Moyenne_Jour=Moyenne_Jour+Temper_Store(ia) C$= format$("%3.2f",Temper_Store(ia)) Fichier.WriteLine C$ ' on le RAZ au fur et à mesure Temper_Store(ia)=0 next ia ' à voir plus tard , pour un stockage annuel ...1 à 366 j Moyenne_Jour=Moyenne_Jour/1440 C$= format$("Moyenne Jour;%3.2f",Moyenne_Jour) Fichier.WriteLine C$ Fichier.close DOEvents Timer1.Enabled=True ' problemo MessageBox est bloquant ! plus de liaison RS232 ' messagebox("Fichier Amps fermé","Sauvegarde",MB_NOFOCUS) ' TT=Timer +5 'soluce de remplacement Label5.Enabled = True Label5.Visible= True ' C$= right$(Time$,2) ia=val(c$) +5 ia=ss+5 do C$= right$(Time$,2) ss=val(c$) ' Label5.Caption="Sauve fichier dans "+C$ DOEvents loop until (ss < ia) 'loop until (TT 0 then kill Chemin + "$$$$$.$$$" end if Fichier.open(Chemin + Ini,fmopenwrite) Fichier.writeline(STR$(Temper_BT.top)) Fichier.writeline(STR$(Temper_BT.left)) Fichier.WriteLine str$(Speed_Combo2.ItemIndex) Fichier.WriteLine str$(Parity_Combo3.ItemIndex) Fichier.WriteLine str$(Nb_Datas_Combo4.ItemIndex) Fichier.WriteLine str$(Nb_Stop_Combo5.ItemIndex) Fichier.WriteLine str$(Port_Combo1.ItemIndex) Fichier.close closecom Application.terminate end sub Sub Message(Situation as single) select case situation case 1 : messagebox( "Probleme sur votre port " + Com,"COM Setup",0) case 2 : messagebox("Selectionner un port Com1, Com2, Com3, ..COM20","COM Setup",0) case 3 : messagebox("Configuration incomplete, PROBLEMO! ","Aie ! Aie",0) case 4 : messagebox("Bye Bye ..","Info",0) case 5: messagebox("Chargement de HELP"+chr$(13)+"..à suivre","Information",0) case 10 : messagebox("Non implanté","info",0) case else end select end sub sub Activer_Port_COM() CLEARBUFFER CLOSECOM String_Comm = Com & "," & Baud & "," & Parite & "," & Nb_Datas & "," & Nb_Stop L2=len(String_Comm ) C$="Version "+ Version +chr$(13)+"chaine setup COM Len=" + STR$(L2)+chr$(13) messagebox(C$,"Info. COM",0) infoCom = OPENCOM(String_Comm) If infoCom = 0 Then message 1 Com = "" Temper_BT.caption = "Port de comm. non reconnu" Port_Combo1.ItemIndex = -1 else Groupe1.caption = "Port ouvert : "+ com + ", " + baud +", "+ Parite + ", "+ Nb_Datas + ", " + Nb_Stop CLEARBUFFER TXD 0 RTS 0 DTR 0 REALTIME end if End sub Sub Port_Combo1Change(Sender as QComboBox) Com = trim(Port_Combo1.Text) Activer_Port_COM End Sub Sub Speed_Combo2Change(Sender as QComboBox) Baud = trim(Speed_Combo2.Text) Activer_Port_COM End Sub Sub Parity_Combo3Change(Sender as QComboBox) Parite = trim(Parity_combo3.Text) Activer_Port_COM End Sub Sub Nb_Datas_Combo4Change(Sender as QComboBox) Nb_Datas = trim(Nb_Datas_Combo4.Text) Activer_Port_COM End Sub Sub Nb_StopChange(Sender as QComboBox) Nb_Stop = trim(Nb_Stop_combo5.Text) Activer_Port_COM End Sub Function Trim(Datum As String) As String if Datum = "" then exit function Trim = LTrim$(RTrim$(Datum)) End Function Sub Help_buttonClick(Sender as QCoolBtn) Message (5) End Sub Function JourSemaine() AS INTEGER dim c as integer dim n$ as string n$=date$ result=-1 mm = val(left$(n$,2)) dd = val(mid$(n$,4,2)) yy = val(right$(n$,4)) ' Zone_Debug.text=str$(mm)+" "+str$(dd)+" "+str$(yy) +chr$(13) if ( (mm>0) AND (mm<13) AND (dd>0) and (dd<32) and (yy>2000) and (yy<2100)) then c=0 c=c+(yy-1900)*365 + int((yy-1900)/4) for i=1 to mm-1 select case i case 1,3,5,7,8,10 c=c+31 case 2 c=c+28 if ((yy-1900) mod 4 = 0) then c=c+1 case 4,6,9,11 c=c+30 end select next c=c+dd result = (c mod 7) ' Zone_Debug.text=chr$(13)+chr$(10)+"result="+str$(result) +chr$(13) else result=-1 end if END FUNCTION Sub RAZ_ReceptionClick(Sender as QButton) Zone_Reception.text="" End Sub Sub SortieClick(Sender as QButton) Save_Temper_to_File Message (4) Temper_BTClose(0) end End Sub