Example in Visual Basic
Private Sub cmdSetBaudRateSM_Click()
Dim ChangeBaudSerialCmd As Integer
Dim BaudRate As Integer
Dim strInputBuf As Variant
Dim PreviousSettings As String
PreviousSettings = commCtrl.Settings
‘Check that we’re in remote and have selected a baud rate If CheckInitialConditions(True, False, True) = False Then
GoTo SetSMBaud_err_handler
End If
ChangeBaudSerialCmd = 197 | ‘Setting Baud rate Serial Command | |
BaudRate = GetBaudSerialCmd | ‘Get the Serial cmd for the specific baud rate | |
commCtrl.Output = Chr$(ChangeBaudSerialCmd) + Chr$(BaudRate) | ‘Sending the data |
Delay (300)
‘Change the Baud setting for the application also If BaudRate = 0 Then
commCtrl.Settings = “9600,n,8,1" ElseIf BaudRate = 1 Then
commCtrl.Settings = “19200,n,8,1" ElseIf BaudRate = 2 Then
commCtrl.Settings = “38400,n,8,1" ElseIf BaudRate = 3 Then
commCtrl.Settings = “56000,n,8,1" ElseIf BaudRate = 4 Then
commCtrl.Settings = “115200,n,8,1"
Else
‘Box will fail, set back to 9600. commCtrl.Settings = “9600,n,8,1"
End If
Delay (1000)
strInputBuf = CStr(commCtrl.Input) strInputBuf = Mid(strInputBuf, 1, 1) If strInputBuf = “” Then
MsgBox “Invalid Baud Rate - NO STRING”
Site Master PM | 117 |