I have a program which is running tests on a monitor using two separate pieces of equipment which are connected to the main computer via COM ports. COM4 is attached to a video generator which accepts simple strings as commands to adjust images displayed on the monitor. The following code is a working example of how this is accomplished:
COM5 has a cable running to the backlight control for the monitor, and needs to have a hexadecimal string sent to set the backlight brightness level. I've searched all over online, and cannot find a complete example of how to accomplish this. I attempted adjusting the previous code to send hex based on one example I found, but it has no effect:
Can anyone clear this up for me or point me to a complete example of sending Hex using the IO.Ports.SerialPort? (or any other method, as long as the example is complete, including the port callout.) I'm working in Visual Studio 2008.
Cheryl dc Kern
Code:
Using Quantum As IO.Ports.SerialPort = _
My.Computer.Ports.OpenSerialPort(Me.txtCom.Text)
strSend = "IMGL RASTER" & vbCrLf
Quantum.WriteLine(strSend)
System.Threading.Thread.Sleep(500)
strSend = "IMGL RASTER" & vbCrLf
Quantum.WriteLine(strSend)
System.Threading.Thread.Sleep(500)
strSend = "IMGU" & vbCrLf
Quantum.WriteLine(strSend)
System.Threading.Thread.Sleep(500)
strSend = "SLUT" & vbCrLf
Quantum.WriteLine(strSend)
System.Threading.Thread.Sleep(500)
strSend = "RECT GREEN 256 256 512 384 GRAYPAT100" & vbCrLf
Quantum.WriteLine(strSend)
System.Threading.Thread.Sleep(500)
strSend = "RGBW 1 " & Rval & " " & Gval & " " & Bval & " " & vbCrLf
Quantum.WriteLine(strSend)
End Using
COM5 has a cable running to the backlight control for the monitor, and needs to have a hexadecimal string sent to set the backlight brightness level. I've searched all over online, and cannot find a complete example of how to accomplish this. I attempted adjusting the previous code to send hex based on one example I found, but it has no effect:
Code:
Dim strBackLevel As String = Me.cbPhase.Text
Dim strBackString As String = ""
Select Case strBackLevel
Case "Day Set"
strBackString = "Chr$(&H07) & Chr$(&HFF) & Chr$(&H42) & Chr$(&H54) & Chr$(&H01) & Chr$(&H10) & Chr$(&HFF) & Chr$(&H00)"
Case "Dusk Set"
strBackString = "Chr$(&H07) & Chr$(&HFF) & Chr$(&H42) & Chr$(&H54) & Chr$(&H01) & Chr$(&H10) & Chr$(&HDF) & Chr$(&H20)"
Case "Night Set"
strBackString = "Chr$(&H07) & Chr$(&HFF) & Chr$(&H42) & Chr$(&H54) & Chr$(&H01) & Chr$(&H10) & Chr$(&H60) & Chr$(&H9F)"
End Select
Using BS As IO.Ports.SerialPort = _
My.Computer.Ports.OpenSerialPort(Me.txtBackCOM.Text)
BS.WriteLine(strBackString)
System.Threading.Thread.Sleep(500)
End Using
Cheryl dc Kern