Controller 8 LEDs (Relay)

Signaler
Messages postés
2
Date d'inscription
jeudi 11 mai 2006
Statut
Membre
Dernière intervention
9 août 2010
-
Messages postés
2
Date d'inscription
jeudi 11 mai 2006
Statut
Membre
Dernière intervention
9 août 2010
-
Salut á tous..

je dois ecrire le programme suivant et je suis debutant en Vbasic et j#ai des problemes avec les boucles.

le programme doit controller un 8 LEDs (Relay).

The Program should work like a loop with at every sequence 1000ms delay or sleep and after the delay; the LEDs would be switch on or off depending on where I am.

These are the steps:

[b]1. Clear all LED or relays // at the beginning
Delay/ Sleep 1000 ms
LEDs or relays 7 and 5 on// Lamps 5 and 7 are on

2. Clear all LED
Delay/ Sleep 1000 ms
LEDs or relays 7 and 1 on // Lamps 1 and 7 are

3. Clear all LED //
Delay/ Sleep 1000 ms
LEDs or PORTs 5 and 6 on // Lamps 5 and 6 are on

4. Clear all LED //
Delay/ Sleep 1000 ms
LEDs or PORTs 1, 7 and 6 on// // Lamps 1, 6 and 7 are on

5. Clear all LED //
Delay/ Sleep 1000 ms
LEDs or PORTs 1 and 7 on// Lamps 1 and 7 are on

6. Clear all LED //
Delay/ Sleep 1000 ms
LEDs or PORTs 2 and 3 on// Lamps 2 and 3 are on

7. Clear all LED //
Delay/ Sleep 1000 ms
LEDs or PORTs 4 and 2 on// Lamps 4 and 2 are on

8. Clear all LED //
Delay/ Sleep 1000 ms
LEDs or PORTs 7 and 2 on// Lamps 7 and 2 are on

(The program should run n times like a loop)

Merci pour tout aide...

2 réponses

Messages postés
1263
Date d'inscription
mardi 11 novembre 2003
Statut
Membre
Dernière intervention
24 juillet 2013
6
Salut
Tes LEds tu les branches où ? a mon avis cela doit être sur le port parallèle Centronics
Il te faut déjà une carte d'interface avec tes LEDs et cette carte se connecte sur le port Centronics
ensuite il te faut une Dll pour piloter ce port
et ensuite tu peux programmer tes sorties parallèles en sorties avec des états logiques 0 ou 1

tu dis avoir des problèmes avec tes boucles : il n'y en a aucune dans ton cahier des charges
ton programme tient en 3 opérations
1 ) éteindre toutes les LEDS
2 ) Un temporisation d'une seconde
3 ) allumer certaines LEDs

La seule boucle est ton programme lui-même qui tourne en boucle et il faudra prévoir un événement pour sortir de la boucle et terminer le programme ( appui sur une touche par exemple)


La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi.

GRENIER Alain
Messages postés
2
Date d'inscription
jeudi 11 mai 2006
Statut
Membre
Dernière intervention
9 août 2010

salut
Merci pour l'intervention rapide.Justement ils sont branché sur le port parallele.
- la carte d'interface a deja ete construite et est prete la dll aussi
- les sorties paralleles et tous les etats 0 ou 1


Mon probleme est justement le programme lui-même en fait ces 3 operations.

1 ) éteindre toutes les LEDS
2 ) Un temporisation d'une seconde
3 ) allumer certaines LEDs



------------------------

VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form form1
BorderStyle = 1 'Fixed Single
Caption = "8 Channel relay board"
ClientHeight = 5025
ClientLeft = 45
ClientTop = 330
ClientWidth = 6195
Icon = "K8056.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5025
ScaleWidth = 6195
StartUpPosition = 3 'Windows Default
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 80
Left = 240
Top = 720
End
Begin VB.CommandButton Command24
Caption = "8"
Height = 375
Index = 7
Left = 3840
TabIndex = 53
Top = 4200
Width = 375
End
Begin VB.CommandButton Command24
Caption = "7"
Height = 375
Index = 6
Left = 3360
TabIndex = 52
Top = 4200
Width = 375
End
Begin VB.CommandButton Command24
Caption = "6"
Height = 375
Index = 5
Left = 2880
TabIndex = 51
Top = 4200
Width = 375
End
Begin VB.CommandButton Command24
Caption = "5"
Height = 375
Index = 4
Left = 2400
TabIndex = 50
Top = 4200
Width = 375
End
Begin VB.CommandButton Command24
Caption = "4"
Height = 375
Index = 3
Left = 1920
TabIndex = 49
Top = 4200
Width = 375
End
Begin VB.CommandButton Command24
Caption = "3"
Height = 375
Index = 2
Left = 1440
TabIndex = 48
Top = 4200
Width = 375
End
Begin VB.CommandButton Command24
Caption = "2"
Height = 375
Index = 1
Left = 960
TabIndex = 47
Top = 4200
Width = 375
End
Begin VB.CommandButton Command24
Caption = "1"
Height = 375
Index = 0
Left = 480
TabIndex = 46
Top = 4200
Width = 375
End
Begin VB.CommandButton Command22
Caption = "8"
Height = 375
Index = 7
Left = 3840
TabIndex = 44
Top = 3360
Width = 375
End
Begin VB.CommandButton Command22
Caption = "7"
Height = 375
Index = 6
Left = 3360
TabIndex = 43
Top = 3360
Width = 375
End
Begin VB.CommandButton Command22
Caption = "6"
Height = 375
Index = 5
Left = 2880
TabIndex = 42
Top = 3360
Width = 375
End
Begin VB.CommandButton Command22
Caption = "5"
Height = 375
Index = 4
Left = 2400
TabIndex = 41
Top = 3360
Width = 375
End
Begin VB.CommandButton Command22
Caption = "4"
Height = 375
Index = 3
Left = 1920
TabIndex = 40
Top = 3360
Width = 375
End
Begin VB.CommandButton Command22
Caption = "3"
Height = 375
Index = 2
Left = 1440
TabIndex = 39
Top = 3360
Width = 375
End
Begin VB.CommandButton Command22
Caption = "2"
Height = 375
Index = 1
Left = 960
TabIndex = 38
Top = 3360
Width = 375
End
Begin VB.CommandButton Command22
Caption = "1"
Height = 375
Index = 0
Left = 480
TabIndex = 37
Top = 3360
Width = 375
End
Begin VB.ComboBox Combo3
Height = 315
Left = 4680
TabIndex = 35
Text = "49"
Top = 360
Width = 1095
End
Begin VB.ComboBox Combo2
Height = 315
Left = 3360
TabIndex = 34
Text = "49"
Top = 360
Width = 1095
End
Begin VB.CommandButton Command21
Caption = "O"
Height = 375
Left = 3840
TabIndex = 33
Top = 2160
Width = 375
End
Begin VB.CommandButton Command20
Caption = "1"
Height = 375
Left = 3840
TabIndex = 32
Top = 1800
Width = 375
End
Begin VB.CommandButton Command19
Caption = "O"
Height = 375
Left = 3360
TabIndex = 31
Top = 2160
Width = 375
End
Begin VB.CommandButton Command18
Caption = "1"
Height = 375
Left = 3360
TabIndex = 30
Top = 1800
Width = 375
End
Begin VB.CommandButton Command17
Caption = "O"
Height = 375
Left = 2880
TabIndex = 29
Top = 2160
Width = 375
End
Begin VB.CommandButton Command16
Caption = "1"
Height = 375
Left = 2880
TabIndex = 28
Top = 1800
Width = 375
End
Begin VB.CommandButton Command15
Caption = "O"
Height = 375
Left = 2400
TabIndex = 27
Top = 2160
Width = 375
End
Begin VB.CommandButton Command14
Caption = "1"
Height = 375
Left = 2400
TabIndex = 26
Top = 1800
Width = 375
End
Begin VB.CommandButton Command13
Caption = "O"
Height = 375
Left = 1920
TabIndex = 25
Top = 2160
Width = 375
End
Begin VB.CommandButton Command12
Caption = "1"
Height = 375
Left = 1920
TabIndex = 24
Top = 1800
Width = 375
End
Begin VB.CommandButton Command11
Caption = "O"
Height = 375
Left = 1440
TabIndex = 23
Top = 2160
Width = 375
End
Begin VB.CommandButton Command10
Caption = "1"
Height = 375
Left = 1440
TabIndex = 22
Top = 1800
Width = 375
End
Begin VB.CommandButton Command9
Caption = "O"
Height = 375
Left = 960
TabIndex = 21
Top = 2160
Width = 375
End
Begin VB.CommandButton Command8
Caption = "1"
Height = 375
Left = 960
TabIndex = 20
Top = 1800
Width = 375
End
Begin VB.CommandButton Command2
Caption = "O"
Height = 375
Left = 480
TabIndex = 19
Top = 2160
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 375
Left = 480
TabIndex = 18
Top = 1800
Width = 375
End
Begin VB.CommandButton Command7
Caption = "change addr."
Height = 375
Left = 4680
TabIndex = 6
Top = 720
Width = 1095
End
Begin VB.CommandButton Command6
Caption = "show addr."
Height = 375
Left = 3360
TabIndex = 5
Top = 720
Width = 1095
End
Begin VB.CommandButton Command5
Caption = "Emergency S T O P"
Height = 1935
Left = 4800
TabIndex = 4
Top = 2760
Width = 975
End
Begin VB.CommandButton Command4
Caption = "CLEAR ALL"
Height = 375
Left = 4680
TabIndex = 3
Top = 2160
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "SET ALL"
Height = 375
Left = 4680
TabIndex = 2
Top = 1800
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 315
Left = 1800
TabIndex = 0
ToolTipText = "Select the serial port"
Top = 240
Width = 615
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 20
Left = 0
Top = 2880
End
Begin MSCommLib.MSComm comm
Left = -120
Top = 2280
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 2
DTREnable = -1 'True
RTSEnable = -1 'True
BaudRate = 2400
End
Begin VB.Frame Frame1
Caption = "Address"
Height = 1215
Left = 3120
TabIndex = 36
Top = 120
Width = 2775
End
Begin VB.Frame Frame2
Caption = "Toggle buttons"
Height = 735
Left = 360
TabIndex = 45
Top = 3120
Width = 4095
End
Begin VB.Frame Frame3
Caption = "Momentary buttons"
Height = 735
Left = 360
TabIndex = 54
Top = 3960
Width = 4095
End
Begin VB.Frame Frame4
Caption = "ON/OFF"
Height = 1095
Left = 360
TabIndex = 55
Top = 1560
Width = 5535
End
Begin VB.Label Label9
Caption = "8"
Height = 255
Left = 3960
TabIndex = 17
Top = 2760
Width = 135
End
Begin VB.Label Label8
Caption = "7"
Height = 255
Left = 3480
TabIndex = 16
Top = 2760
Width = 135
End
Begin VB.Label Label7
Caption = "6"
Height = 255
Left = 3000
TabIndex = 15
Top = 2760
Width = 255
End
Begin VB.Label Label6
Caption = "5"
Height = 255
Left = 2520
TabIndex = 14
Top = 2760
Width = 255
End
Begin VB.Label Label5
Caption = "4"
Height = 255
Left = 2040
TabIndex = 13
Top = 2760
Width = 255
End
Begin VB.Label Label4
Caption = "3"
Height = 255
Left = 1560
TabIndex = 12
Top = 2760
Width = 255
End
Begin VB.Label Label3
Caption = "Label3"
Height = 15
Index = 3
Left = 0
TabIndex = 11
Top = 0
Width = 135
End
Begin VB.Label Label3
Caption = "2"
Height = 255
Index = 2
Left = 1080
TabIndex = 10
Top = 2760
Width = 135
End
Begin VB.Label Label3
Caption = "Label3"
Height = 15
Index = 1
Left = 0
TabIndex = 9
Top = 0
Width = 135
End
Begin VB.Label Label3
Caption = "Label3"
Height = 15
Index = 0
Left = 360
TabIndex = 8
Top = 1680
Width = 135
End
Begin VB.Label Label2
Caption = "1"
Height = 255
Left = 600
TabIndex = 7
Top = 2760
Width = 255
End
Begin VB.Label Label1
Caption = "Choose serial port"
Height = 255
Left = 360
TabIndex = 1
Top = 240
Width = 1335
End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim messagestring As String 'will contain all messages to transmit
Dim charcounter As Integer 'will keep track of the position in messagestring
Dim address As Integer
Dim factor As Integer

Dim port As String 'keeps serial port #


Private Sub Combo1_Change()
If comm.PortOpen True Then comm.PortOpen False

port = Combo1.Text

comm.CommPort = Val(Combo1)
comm.Handshaking = None
comm.Settings = "2400,N,8,1"
comm.OutBufferSize = 4096
comm.InputLen = 0
comm.RThreshold = 1
comm.SThreshold = 1
comm.DTREnable = True

comm.PortOpen = True
End Sub

Private Sub Combo1_Click()
If comm.PortOpen True Then comm.PortOpen False

port = Combo1.Text

comm.CommPort = Val(Combo1)
comm.Handshaking = None
comm.Settings = "2400,N,8,1"
comm.OutBufferSize = 4096
comm.InputLen = 0
comm.RThreshold = 1
comm.SThreshold = 1
comm.DTREnable = True

comm.PortOpen = True
End Sub













Private Sub Combo2_Change()
address = Val(Combo2.Text)

End Sub

Private Sub Combo2_Click()
address = Val(Combo2.Text)
End Sub



Private Sub Command1_Click()
checksum = (255 - ((((13 + address + Asc("S") + Asc("1")) / 256) - Int((13 + address + Asc("S") + Asc("1")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "S1" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command10_Click()
checksum = (255 - ((((13 + address + Asc("S") + Asc("3")) / 256) - Int((13 + address + Asc("S") + Asc("3")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "S3" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command11_Click()
checksum = (255 - ((((13 + address + Asc("C") + Asc("3")) / 256) - Int((13 + address + Asc("C") + Asc("3")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "C3" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub





Private Sub Command12_Click()
checksum = (255 - ((((13 + address + Asc("S") + Asc("4")) / 256) - Int((13 + address + Asc("S") + Asc("4")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "S4" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command13_Click()
checksum = (255 - ((((13 + address + Asc("C") + Asc("4")) / 256) - Int((13 + address + Asc("C") + Asc("4")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "C4" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command14_Click()
checksum = (255 - ((((13 + address + Asc("S") + Asc("5")) / 256) - Int((13 + address + Asc("S") + Asc("5")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "S5" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command15_Click()
checksum = (255 - ((((13 + address + Asc("C") + Asc("5")) / 256) - Int((13 + address + Asc("C") + Asc("5")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "C5" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command16_Click()
checksum = (255 - ((((13 + address + Asc("S") + Asc("6")) / 256) - Int((13 + address + Asc("S") + Asc("6")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "S6" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command17_Click()
checksum = (255 - ((((13 + address + Asc("C") + Asc("6")) / 256) - Int((13 + address + Asc("C") + Asc("6")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "C6" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command18_Click()
checksum = (255 - ((((13 + address + Asc("S") + Asc("7")) / 256) - Int((13 + address + Asc("S") + Asc("7")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "S7" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command19_Click()
checksum = (255 - ((((13 + address + Asc("C") + Asc("7")) / 256) - Int((13 + address + Asc("C") + Asc("7")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "C7" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command2_Click()
checksum = (255 - ((((13 + address + Asc("C") + Asc("1")) / 256) - Int((13 + address + Asc("C") + Asc("1")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "C1" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command20_Click()
checksum = (255 - ((((13 + address + Asc("S") + Asc("8")) / 256) - Int((13 + address + Asc("S") + Asc("8")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "S8" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command21_Click()
checksum = (255 - ((((13 + address + Asc("C") + Asc("8")) / 256) - Int((13 + address + Asc("C") + Asc("8")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "C8" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub




Private Sub Command22_Click(Index As Integer)

factor = Str$(Command22(Index).Index + 1)

checksum = (255 - ((((13 + address + Asc("T") + Asc(factor)) / 256) - Int((13 + address + Asc("T") + Asc(factor)) / 256)) * 256)) + 1
messagestring = Chr$(13) & Chr$(address) & "T" & factor & Chr$(checksum)

messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub







Private Sub Command24_Click(Index As Integer)
Command5.SetFocus
Timer2.Enabled = False

End Sub

Private Sub Command24_GotFocus(Index As Integer)

factor = Str$(Command22(Index).Index + 1)

checksum = (255 - ((((13 + address + Asc("P") + Asc(factor)) / 256) - Int((13 + address + Asc("P") + Asc(factor)) / 256)) * 256)) + 1
messagestring = Chr$(13) & Chr$(address) & "P" & factor & Chr$(checksum)

messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
Timer2.Enabled = True


End Sub

Private Sub Command3_Click()
checksum = (255 - ((((13 + address + Asc("S") + Asc("9")) / 256) - Int((13 + address + Asc("S") + Asc("9")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "S9" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command4_Click()
checksum = (255 - ((((13 + address + Asc("C") + Asc("9")) / 256) - Int((13 + address + Asc("C") + Asc("9")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "C9" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command5_Click()
checksum = (255 - ((((13 + address + Asc("E") + Asc("1")) / 256) - Int((13 + address + Asc("E") + Asc("1")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "E1" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command6_Click()
checksum = (255 - ((((13 + address + Asc("D") + Asc("1")) / 256) - Int((13 + address + Asc("D") + Asc("1")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "D1" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command7_Click()

checksum = (255 - ((((13 + address + Asc("A") + Val(Combo3.Text)) / 256) - Int((13 + address + Asc("A") + Val(Combo3.Text)) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "A" & Chr$(Val(Combo3.Text)) & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
Combo2.Text = Combo3.Text

End Sub

Private Sub Command8_Click()
checksum = (255 - ((((13 + address + Asc("S") + Asc("2")) / 256) - Int((13 + address + Asc("S") + Asc("2")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "S2" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Command9_Click()
checksum = (255 - ((((13 + address + Asc("C") + Asc("2")) / 256) - Int((13 + address + Asc("C") + Asc("2")) / 256)) * 256)) + 1

messagestring = Chr$(13) & Chr$(address) & "C2" & Chr$(checksum)
messagestring = messagestring & messagestring
messagestring = messagestring & messagestring
comm.Output = messagestring
End Sub

Private Sub Form_Load()

address = 1

For t = 1 To 255

Combo2.AddItem (Str$(t))
Combo3.AddItem (Str$(t))
Next t
Combo2.Text = "1"



Timer1.Enabled = False
On Error GoTo no_port


flag = True
comm.CommPort = "1"
comm.PortOpen = True
Combo1.AddItem ("1")
comm.PortOpen = False

retry_port:
flag = False

comm.CommPort = "2"
comm.PortOpen = True
Combo1.AddItem ("2")
comm.PortOpen = False

Combo1.Text = Combo1.List(0)
Exit Sub

no_port:
If flag = True Then GoTo retry_port
Combo1.Text = Combo1.List(0)



End Sub

Private Sub Form_Terminate()
comm.DTREnable = False

If comm.PortOpen True Then comm.PortOpen False
End Sub





Private Sub Timer1_Timer()

tekst = Mid$(messagestring, charcounter, 1)
If tekst "$" Then tekst Chr$(11)
comm.Output = tekst

charcounter = charcounter + 1
If charcounter Len(messagestring) + 1 Then Timer1.Enabled False



End Sub

Private Sub Timer2_Timer()

comm.Output = messagestring
End Sub

---------------------

Merci encore pour tout aide