Buona sera a tutti.
Sono alle prese con l'interfacciamento di una scheda per motori passo-passo pilotata da vb6.
Vorrei modificare il codice nel modo che ora spieghero':
La form ha un command1 dove vi e' questo codice sull evento click:
Timer1.Interval = 40
Timer1.Enabled = True
Il timer1 hail seguente codice:
Timer3.Enabled = True
Command1.Enabled = False
stringa$ = Text1.Text
charpos = charpos + 1
dato$ = Mid$(stringa$, charpos, 1)
ascii = Asc(dato$)
ProgressBar1.Value = charpos
Rem presenta sull'uscita della porta LP1 il
Rem dato
DlPortWritePortUchar (888), ascii
Rem abilita lo strobe
DlPortWritePortUchar (890), 1
Timer2.Interval = 2
Timer2.Enabled = True
If charpos = 21 Then
Rem spegne timer
Timer1.Enabled = False
Rem riabilita il tasto
' Command1.Enabled = True
Rem resetta posizione carattere da
Rem inviare e la porta LPT1
charpos = 0
DlPortWritePortUchar (888), 0
ProgressBar1.Value = 0
GoTo nodata
End If
nodata:
il timer2:
Private Sub Timer2_Timer()
DlPortWritePortUchar (890), 0
Timer2.Enabled = False
End Sub
il timer3:
Private Sub Timer3_Timer()
Status = DlPortReadPortUchar(889)
Statusbit4 = Status And 16
If Statusbit4 = 0 Then
Frame1.Caption = "INTERFACE BUSY"
Frame1.BackColor = &HFF&
Command1.Enabled = False
Else
Timer3.Enabled = False
Frame1.Caption = "INTERFACE READY"
Frame1.BackColor = &HFF00&
Command1.Enabled = True
End If
End Sub
La mi a esigenza e':
fare in modo che quando il timer3 si disabiliti,generi una variabile di ritorno visibile sotto la routine del command1 e quando questa e' nello stato True mi esca un messaggio di avviso
Pertanto il command1 dovrebbe essere:
Timer1.Interval = 40
Timer1.Enabled = True
If Variabiledi ritornodatimer3=false
alspetta fino a quando diventa true
se diventata true msgbox "OK"
Grazie