📄 gpdppg.frm
字号:
Caption = "8-Bit Integer"
Enabled = 0 'False
Height = 375
Left = 120
TabIndex = 11
Top = 240
Width = 1335
End
End
End
Attribute VB_Name = "GPDPpg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public CCSetup As Object
Public CurrentSelectedBoard As String
Public CurrentSelectedProcessor As String
Public DataTypeOption As String
Public ChannelTypeOption As String
Public DataValid As Boolean
Private Sub Form_Load()
Dim status As Long
Dim BoardName As String
Dim ProcessorName As String
' Instantiate the Code Composer Setup SystemSetup coclass and obtain a
' pointer to the ISystemSetup interface
Set CCSetup = CreateObject("CodeComposerSetup.SystemSetup")
' Get Available Boards and Processors
If (GetAvailableBoards) Then
' Set the selected board to 0
list_Boards.Selected(0) = True
End If
' Set default values for text boxes
txt_ChannelName = ""
txt_MaxMessages = ""
txt_MaxMembers = ""
' Set current channel type to Read
opt_ReadChannel.Value = True
ChannelTypeOption = TYPE_READ_ONLY
' Set current data type to 16-bit integer
opt_16BitInteger.Value = True
DataTypeOption = TYPE_16BIT_INTEGER
DataValid = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set CCSetup = Nothing
End Sub
Private Sub cmd_Cancel_Click()
' Hide the property page
GPDPpg.Hide
End Sub
Private Sub cmd_OK_Click()
' If input values are valid then hide the property page
If (Input_Values_Valid()) Then
GPDPpg.Hide
End If
End Sub
Private Function Input_Values_Valid() As Boolean
Dim char_incr As Integer
' Test input values
If (txt_ChannelName.Text = "") Then
MsgBox ("Error: Channel name has not been included")
DataValid = False
Input_Values_Valid = DataValid
Exit Function
End If
If (((Val(txt_MaxMessages.Text)) <= 0) Or (txt_MaxMessages.Text = "")) Then
MsgBox ("Error: MAX MESSAGES must be greater than 0!")
DataValid = False
Input_Values_Valid = DataValid
Exit Function
End If
If (((Val(txt_MaxMembers.Text)) <= 0) Or (txt_MaxMembers.Text = "")) Then
MsgBox ("Error: MAX MEMBERS must be greater than 0!")
DataValid = False
Input_Values_Valid = DataValid
Exit Function
End If
DataValid = True
Input_Values_Valid = DataValid
End Function
Private Function GetAvailableBoards() As Boolean
Dim status As Long
Dim BoardName As String
Dim ccsBoards As Object
Dim ccsBoard As Object
' Initialize List
list_Boards.Clear
' Get a pointer to the IBoards interface
status = CCSetup.GetBoards(ccsBoards)
' Loop through the available boards, get the names of the boards,
' and add the board names to the boards list control
For Each ccsBoard In ccsBoards
' Get the board name
status = ccsBoard.GetName(BoardName)
' Append board name to the board list
list_Boards.AddItem BoardName
Next
' return True
GetAvailableBoards = True
Set ccsBoards = Nothing
Set ccsBoard = Nothing
End Function
Private Function GetAvailableProcessors(SelectedBoardName As String) As Boolean
Dim status As Long
Dim ProcessorName As String
Dim ProcessorType As String
Dim ccsBoard As Object
Dim ccsProcessors As Object
Dim ccsProcessor As Object
' Initialize List
list_Processors.Clear
' Get a pointer to the IBoard interface for the selected board
status = CCSetup.GetBoardByName(SelectedBoardName, ccsBoard)
' Get a pointer to the IProcessors interface
status = ccsBoard.GetProcessors(ccsProcessors)
' Loop through the available processors, get the names of the
' processors, and add the processors to the processors list
' control
For Each ccsProcessor In ccsProcessors
' Get the processor name
status = ccsProcessor.GetName(ProcessorName)
status = ccsProcessor.GetType(ProcessorType)
' Append processor name to the processor list
list_Processors.AddItem ProcessorName
Next
' Return True
GetAvailableProcessors = True
End Function
Private Sub list_Boards_Click()
' Clear processor list
list_Processors.Clear
' Get current selected board
CurrentSelectedBoard = list_Boards.List(list_Boards.ListIndex)
' Get available processors for that board
If (GetAvailableProcessors(CurrentSelectedBoard)) Then
' Set the selected processor to 0
list_Processors.Selected(0) = True
End If
End Sub
Private Sub list_Processors_Click()
' Get current selected processor
CurrentSelectedProcessor = list_Processors.List(list_Processors.ListIndex)
' Set data type based on target type.
' - not done yet...
End Sub
Private Sub opt_16BitInteger_Click()
DataTypeOption = TYPE_16BIT_INTEGER
End Sub
Private Sub opt_32BitFloat_Click()
DataTypeOption = TYPE_32BIT_FLOAT
End Sub
Private Sub opt_32BitInteger_Click()
DataTypeOption = TYPE_32BIT_INTEGER
End Sub
Private Sub opt_64BitFloat_Click()
DataTypeOption = TYPE_64BIT_FLOAT
End Sub
Private Sub opt_8BitInteger_Click()
DataTypeOption = TYPE_8BIT_INTEGER
End Sub
Private Sub opt_ReadChannel_Click()
ChannelTypeOption = TYPE_READ_ONLY
End Sub
Private Sub opt_WriteChannel_Click()
ChannelTypeOption = TYPE_WRITE_ONLY
End Sub
Private Sub txt_ChannelName_KeyPress(KeyAscii As Integer)
If (KeyAscii = 8) Then ' backspace
ElseIf ((KeyAscii >= Asc("A")) And (KeyAscii <= Asc("Z"))) Then
ElseIf ((KeyAscii >= Asc("a")) And (KeyAscii <= Asc("z"))) Then
ElseIf (KeyAscii = Asc("_")) Then
ElseIf ((Len(txt_ChannelName) > 0) And _
((KeyAscii >= Asc("0")) And (KeyAscii <= Asc("9")))) Then
' first character must be non-numeric.
Else
KeyAscii = 0 ' reject all special characters.
End If
End Sub
Private Sub txt_MaxMembers_KeyPress(KeyAscii As Integer)
' Reject all non-numeric characters
If (KeyAscii = 8) Then ' backspace
ElseIf ((KeyAscii >= Asc("0")) And (KeyAscii <= Asc("9"))) Then
Else
KeyAscii = 0
End If
End Sub
Private Sub txt_MaxMessages_KeyPress(KeyAscii As Integer)
' Make sure that key pressed is a numeric character
If (KeyAscii = 8) Then ' backspace
ElseIf ((KeyAscii >= Asc("0")) And (KeyAscii <= Asc("9"))) Then
Else
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -