Bonjour,
j'utilise le port RS232 pour simplement écrire vers l'extérieur (switch on/off d'une alim). Le problème est que je n'arrive pas à envoyer mes commandes, car jai une exception COMException, m'indiquant que la méthode est introuvable.
Voici mon code :
Sub initComPort(ByVal numPort As Short, ByVal handshaking As Short, ByVal RThreshold As Short, ByVal RTS As Boolean, ByVal properties As String, ByVal SThreshold As Short)
ComPort1 = New MSCommLib.MSComm
With ComPort1 'configuration du port
.CommPort = numPort 'On utilise le port COM1:
.Handshaking = handshaking 'RTS
.RThreshold = RThreshold
.RTSEnable = True 'mieux pour le port COM:
.Settings = properties
.SThreshold = SThreshold
.PortOpen = True 'ouverture du port
End With
End Sub
Function alimSwitch(ByVal state As Boolean) As Integer
Dim x As Short
If state = True Then
ComPort1.Output("OUTP:STAT ON")
Else
ComPort1.Output("OUTP:STAT OFF")
End If
End Function
Sub CompPort1Open(ByVal open As Boolean)
ComPort1.PortOpen = open
End Sub
Lorsque j'utilise le debugger de vb.net, je constate que mes propriétés du rs232 sont bien prises en compte, mais jai peut etre un problème de déclaration car déjà, je peux voir que la méthode output est une exception (Systme.Runtime.InteropServices.COMEexception)...
Merci pour votre aide..
Rappel : je travaille sous vb.net