As described in the subject, I'm attempting to send 8-bit data to an external component using the serial port. However, it appears that the top two bits are being forced to 0; any value I attempt to send above 3F is 3F at the other end. Can anyone see what's wrong based on the code below, which is the entirety of the code I'm using to do this (no other setup or call outs in the application)?
When any of the three strings above are sent, all values read correctly on the other end with the exception of the values above 3F, all of which read 3F.
I'm working in Visual Studio 2008 with VB.net
Cheryl dc Kern
Code:
Dim strBackLevel As String = Me.cbPhase.Text
Dim strBackString As String = ""
Dim BS As New IO.Ports.SerialPort
BS.PortName = Me.txtBackCOM.Text 'sets the COM port based on the selection on the main form
BS.BaudRate = 9600
BS.StopBits = IO.Ports.StopBits.One
BS.DataBits = 8
BS.Parity = IO.Ports.Parity.None
If BS.IsOpen = False Then
BS.Open()
End If
Select Case strBackLevel 'sets the hex values based on the combobox selection on main form
Case "Day Set"
strBackString = Chr(&H7) & Chr(&HFF) & Chr(&H42) & Chr(&H52) & Chr(&H54) _
& Chr(&H1) & Chr(&H10) & Chr(&H82) & Chr(&H0)
BS.Write(strBackString)
Case "Dusk Set"
strBackString = Chr(&H7) & Chr(&HFF) & Chr(&H42) & Chr(&H52) & Chr(&H54) _
& Chr(&H1) & Chr(&H10) & Chr(&HDF) & Chr(&H20)
BS.Write(strBackString)
Case "Night Set"
strBackString = Chr(&H7) & Chr(&HFF) & Chr(&H42) & Chr(&H52) & Chr(&H54) _
& Chr(&H1) & Chr(&H10) & Chr(&H60) & Chr(&H9F)
BS.Write(strBackString)
End Select
BS.Close()
When any of the three strings above are sent, all values read correctly on the other end with the exception of the values above 3F, all of which read 3F.
I'm working in Visual Studio 2008 with VB.net
Cheryl dc Kern