Bonjour a tous
J'ai un petit probleme avec la fonction DataReceived. Interuption a la reception d'un byte ne fonctionne pas.
J'ai pourtant cherché sur plusieur site et livre mes j'ai rien trouvé.
J'ai un pic qui m'envoye un byte sur le port COM RS232.
Si je met "instance.ReadByte" dans un timer ceci fonctionne correctement.
Mes si je prend la fonction interuption port com
"Private
Sub RS232_DataReceived(
ByVal sender
As
Object,
ByVal e
As System.IO.Ports.SerialDataReceivedEventArgs)
Handles RS232.DataReceived"
Le programme ne vas pas dans interuption.
Programme fait sur "Microsoft Visual Basic 2008 Expresse"
Je souhaiterai SVP vottre aide si vous trouvé mon erreur.
Merci de vottre aide !
Telecharger mon Programme sur :
http://dhinni88.free.fr/RS232.zip
Ou voici mon code:
Imports
System.IO.Ports
Public
Class Form
Dim instance
As
New SerialPort
Private
Sub Form1_Load(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles
MyBase.Load
instance.Open()
End
Sub
Private
Sub Button1_Click(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles Quitter.Click
instance.Close()
Close()
End
Sub
Private
Sub Button2_Click(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles Button2.Click
instance.Write(TextBox1.Text)
End
Sub
Private
Sub Timer1_Tick(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles Timer1.Tick
End
Sub
Private
Sub RS232_DataReceived(
ByVal sender
As
Object,
ByVal e
As System.IO.Ports.SerialDataReceivedEventArgs)
Handles RS232.DataReceived
Label1.Text = Convert.ToChar(instance.ReadByte)
Label2.Text = (
"Interupte en fonction")
End
Sub
End
Class