Again I am not a C# user (probably should learn it more for the fun of it…)
But I have don lots with C and C++ and I have played around with Visual Studio with Visual basic… So my solution may not be 100% correct but hopefully will help.
Yes you need to do the COM.WriteLine… Since you are adding on the CR you may be able to use Write instead…
I would then probably make sure it went out to the SSC-32. In VB would do this like:
COM.BaseStream.Flush();
Also before the command, I would probably Clear the Serial input buffer… An example of what I use in one of my VB apps looks like:
[code] Public Sub ClearInputBuffer(ByRef com1 As IO.Ports.SerialPort)
Dim cbRead As Byte
Dim b(1) As Byte
com1.DiscardInBuffer() ' flush out anything we have
cbRead = 1
com1.ReadTimeout = 100 'wait a maximum of .1 seconds for a response
Try
While cbRead > 0
cbRead = com1.Read(b, 0, 1)
End While
Catch ex As Exception
End Try
End Sub
[/code]
The Q command returns a single character so you don’t want to use ReadLine, but instead Read(). In VB I would also probably use a timeout in case something went wrong. So I would use a lot of stuff similar to what I did for the ClearInputBuffer above…
Hope that helps
Kurt