hello all...
this is my first post... :)
i need to send specific characters on rs232 at specified intervals...
i call the 1st sub and it sends something on rs232 using trysend sub and for the delay i've used a variable timercnt1 ... u set timercnt1 to 50 and enable the timer.... as the timer ticks it counts down and at 0 it shuts off...
[code=vbnet]
Private Sub stdlengthcmdsen d()
' motor1 start at full speed
trysend("9" & "1")
timercnt1 = 50
Timer1.Enabled = True
While timercnt1 <> 0
' delay
End While
'WriteMessage(" while end" & Chr(13), True)
'motor stop
' in this time it wud've covered the dstance...
trysend("q")
trysend("3")
End Sub
Private Sub timer1_tick(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles Timer1.Tick
' For 5 seconds 50 ticks
If timercnt1 = 0 Then
Timer1.Enabled = False
'oCP.Write(Enco ding.ASCII.GetB ytes(textinbox & Chr(13)))
'WriteMessage(" time up" & Chr(13), True)
End If
timercnt1 = timercnt1 - 1
End Sub[/code]
and now..... the problem with this is....
it simply hangs... nothign happens.. and i believe nothing is sent on rs232 second time when it has to... i guess its stuck in the while loop
i've checked out the sleep option....
but the problem with that is... my form has grafix that have to be drawn.. so if u go in sleep once they're lost...
please suggest alternatives...
thanks :)
this is my first post... :)
i need to send specific characters on rs232 at specified intervals...
i call the 1st sub and it sends something on rs232 using trysend sub and for the delay i've used a variable timercnt1 ... u set timercnt1 to 50 and enable the timer.... as the timer ticks it counts down and at 0 it shuts off...
[code=vbnet]
Private Sub stdlengthcmdsen d()
' motor1 start at full speed
trysend("9" & "1")
timercnt1 = 50
Timer1.Enabled = True
While timercnt1 <> 0
' delay
End While
'WriteMessage(" while end" & Chr(13), True)
'motor stop
' in this time it wud've covered the dstance...
trysend("q")
trysend("3")
End Sub
Private Sub timer1_tick(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles Timer1.Tick
' For 5 seconds 50 ticks
If timercnt1 = 0 Then
Timer1.Enabled = False
'oCP.Write(Enco ding.ASCII.GetB ytes(textinbox & Chr(13)))
'WriteMessage(" time up" & Chr(13), True)
End If
timercnt1 = timercnt1 - 1
End Sub[/code]
and now..... the problem with this is....
it simply hangs... nothign happens.. and i believe nothing is sent on rs232 second time when it has to... i guess its stuck in the while loop
i've checked out the sleep option....
but the problem with that is... my form has grafix that have to be drawn.. so if u go in sleep once they're lost...
please suggest alternatives...
thanks :)
Comment