Bonjour à tous, j'ai un petit problème avec la réception sur VB j'envoi la valeur 1023 via un picbasic à 9600 Bauds et la valeur reçue reste fixe à 203.
Si quelqu'un à une solution je l'en remerci ci joint mon programme:
Const Serveur = "Excel|C:\Documents and Settings\sts2\Bureau\PROJET\Visual Basic2\Analyseur_PC\relever_polluants.xls"
Public ligne As Integer
Public colonne As Integer
Public Mess As String
Private Sub Com1_Click()
Com1.Checked = True
Com2.Checked = False
MSComm1.CommPort = 1
End Sub
Private Sub Com2_Click()
Com2.Checked = True
Com1.Checked = False
MSComm1.CommPort = 2
End Sub
Private Sub Command1_Click()
Select Case Command1.Caption
Case "Acquisition"
Command1.Caption = "Arrêt"
MSComm1.Settings = "9600,N,8,1"
MSComm1.RThreshold = 3
MSComm1.PortOpen = True
Case "Arrêt"
Command1.Caption = "Acquisition"
MSComm1.PortOpen = False
End Select
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Excel_Click()
'Ouverture de l'application
Set appExcel = CreateObject("Excel.Application")
'Ouverture d'un fichier Excel
Set wbExcel = appExcel.Workbooks.Open("C:\Documents and Settings\sts2\Bureau\PROJET\Visual Basic2\Analyseur_PC\relever_polluants.xls")
'appExcel.visible=True permet de rendre la fenetre visible, car sans sa, elle est ouverte mais pas visible
appExcel.Visible = True
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub Form_Load()
MSComm1.InputLen = 3
ligne = 2
Label3.LinkTopic = Serveur
Label3.LinkMode = 2
Label1.LinkTopic = Serveur
Label1.LinkMode = 2
End Sub
Private Sub Notice_Click()
'permet d'ouvrir la notice d'utilisation
Shell "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe C:\Analyseur_PC\Notice.pdf"
End Sub
Private Sub Print_Click()
Dim appExcel As Excel.Application 'Application Excel
Dim wbExcel As Excel.Workbook 'Classeur Excel
Dim wsExcel As Excel.Worksheet 'Feuille Excel
'Ouverture de l'application
Set appExcel = CreateObject("Excel.Application")
'Ouverture d'un fichier Excel
Set wbExcel = appExcel.Workbooks.Open("C:\Documents and Settings\sts2\Bureau\PROJET\Visual Basic2\Analyseur_PC\relever_polluants.xls")
'wsExcel correspond à la première feuille du fichier
Set wsExcel = wbExcel.Worksheets(1)
ActiveWindow.SelectedSheets.PrintOut Copies:=1
wbExcel.Close
Set wbExcel = Nothing
appExcel.Quit
End Sub
Private Static Sub MSComm1_OnComm()
Dim résultat() As Byte
Dim Quantité As Byte
Select Case MSComm1.CommEvent
Case comEvReceive
résultat = MSComm1.Input
Quantité = résultat
Label3.Caption = Quantité
Label1.Caption = Time
Label3.LinkItem = "L" & ligne & "C2"
Label1.LinkItem = "L" & ligne & "C1"
Label3.LinkPoke
Label1.LinkPoke
ligne = ligne + 1
End Select
End Sub
Private Sub Version_Click()
'affiche le message version ...
Mess = "Version 1.0 Copyright by Chris"
'la message box qui souvre sappele Analyseur PC
MsgBox Mess, vbOKOnly + vbInformation, "Acquisiton ppb"
End Sub