📄 signalfrm.frm
字号:
VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.Form signalfrm
BackColor = &H00404040&
Caption = "signalprog"
ClientHeight = 5595
ClientLeft = 60
ClientTop = 345
ClientWidth = 10080
ForeColor = &H00000000&
Icon = "signalfrm.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5595
ScaleWidth = 10080
StartUpPosition = 3 'Windows Default
Begin MSChart20Lib.MSChart ReceivedSignal
Height = 3015
Left = 0
OleObjectBlob = "signalfrm.frx":030A
TabIndex = 1
Top = 2640
Width = 8655
End
Begin MSChart20Lib.MSChart TransmittedSignal
Height = 2655
Left = 0
OleObjectBlob = "signalfrm.frx":25A5
TabIndex = 0
Top = 0
Width = 8655
End
Begin VB.Timer tmr_MethodDispatch
Enabled = 0 'False
Interval = 1
Left = 8640
Top = 4680
End
Begin VB.CommandButton cmd_Toggle
Caption = "Off"
Height = 1095
Left = 8640
TabIndex = 2
Top = 0
Width = 1095
End
End
Attribute VB_Name = "signalfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'#######################################################################
' TTT The Real-Time Data Exchange (RTDX) Displays
' TTT i
'TTTTT TiTTTT The following display is used to demonstrate RTDX.
' T -i- T This display was designed to use the Object Linking
' TTT i T And Embedding(OLE) interface to Texas Instruments'
' T TT TT debugger (Code Composer). The primary purpose for the
' TT TT display is to expose target transmitted data in
' TTT Real-Time.
' TT
' Copyright 1997-2000 Texas Instruments
' RTDX is a trademark of Texas Instruments
'_______________________________________________________________________
' This display attempts to transmit 64 sample signal to the target.
' Depending on the transmission status, the display will then attempt to
' read a 64 sample signal. Both signals with be displayed in a
' 2-dimensional chart.
'#######################################################################
' RTDX OLE API Status Return codes
Const SUCCESS = &H0 'Method call succussful
Const FAIL = &H80004005 'Method call failure
Const ENoDataAvailable = &H8003001E 'No data is currently available
Const EEndOfLogFile = &H80030002 'End of log file
Const SAMPLE_SIZE = 64 '# of samples
Const Pi = 3.141592654 'Pi
' Form and control orignal size and positions
Const FORM_START_WIDTH = 9870
Const FORM_START_HEIGHT = 5475
Const TRANSMITTED_CHART_START_WIDTH = 8655
Const TRANSMITTED_CHART_START_HEIGHT = 2535
Const TRANSMITTED_CHART_START_LEFT = 0
Const TRANSMITTED_CHART_START_TOP = 0
Const RECEIVED_CHART_START_WIDTH = 8655
Const RECEIVED_CHART_START_HEIGHT = 2535
Const RECEIVED_CHART_START_LEFT = 0
Const RECEIVED_CHART_START_TOP = 2520
Const TOGGLE_BUTTON_START_WIDTH = 1095
Const TOGGLE_BUTTON_START_HEIGHT = 1095
Const TOGGLE_BUTTON_START_LEFT = 8640
Const TOGGLE_BUTTON_START_TOP = 0
' Channel name constants
Const READ_CHANNEL = "D2A_channel"
Const WRITE_CHANNEL = "A2D_channel"
' Toggle constants
Const START_CAPTION = "Test ON"
Const STOP_CAPTION = "Test OFF"
Dim fromDSP As Object ' Variable for RTDX object instantiation
Dim toDSP As Object ' Variable for RTDX object instantiation
Dim status As Long ' Method status variable
Public Sub Test_ON()
'#######################################################################
' This procedure is called by procedure, cmd_Toggle_Click(). Its job is
' instantiate the RTDX Exported Interface, open the channels, enable
' channels and enable the timer(tmr_MethodDispatch_Timer()).
'#######################################################################
Dim response As Integer ' Response variable for message box
' RTDX Exported Interface intstantiations
Set toDSP = CreateObject("RTDX") ' Create an instance of the RTDX
' Exported Interface for data
' transmission (write)
On Error GoTo On_Error ' Test object instantiation
Set fromDSP = CreateObject("RTDX") ' Create an instance of the RTDX
' Exported Interface for data
' reception (read)
On Error GoTo On_Error ' Test object instantiation
' Set the desired board and processor
status = fromDSP.SetProcessor(BoardProc_frm.CurrentSelectedBoard, _
BoardProc_frm.CurrentSelectedProcessor)
If status <> SUCCESS Then
response = MsgBox("Error: SetProcessor failed ", vbCritical)
Exit Sub
End If
status = toDSP.SetProcessor(BoardProc_frm.CurrentSelectedBoard, _
BoardProc_frm.CurrentSelectedProcessor)
If status <> SUCCESS Then
response = MsgBox("Error: SetProcessor failed ", vbCritical)
Exit Sub
End If
status = fromDSP.Open(READ_CHANNEL, "R") ' Open up the read channel
If status <> SUCCESS Then ' verify that channel is opened
response = MsgBox("Error: Opening the channel " + _
READ_CHANNEL + " Failed", vbCritical)
Exit Sub
End If
status = toDSP.Open(WRITE_CHANNEL, "W") ' Open up the write channel
If status <> SUCCESS Then ' verify that channel is opened
response = MsgBox("Error: Opening the channel " + _
WRITE_CHANNEL + " Failed", vbCritical)
Exit Sub
End If
status = toDSP.EnableChannel(WRITE_CHANNEL) ' Enable write channel
If status <> SUCCESS Then ' verify that channel is enabled
response = MsgBox("Error: Enabling the channel " + _
WRITE_CHANNEL + " Failed", vbCritical)
Exit Sub
End If
status = fromDSP.EnableChannel(READ_CHANNEL) ' Enable read channel
If status <> SUCCESS Then ' verify that channel is enabled
response = MsgBox("Error: Enabling the channel " + _
READ_CHANNEL + " Failed", vbCritical)
Exit Sub
End If
Clear_Charts ' Clear charts
cmd_Toggle.Caption = STOP_CAPTION ' Change command button caption
tmr_MethodDispatch.Enabled = True ' Enable timer method dispatch
Exit Sub
On_Error:
response = MsgBox("Error: Instantiation Failed", vbCritical)
End Sub
Public Sub Test_OFF()
'#######################################################################
' This procedure is called by procedure, cmd_Toggle_Click(). Its job is
' to close the channels, disable channels, release reference to RTDX
' object and disable the timer (tmr_MethodDispatch_Timer()).
'#######################################################################
tmr_MethodDispatch.Enabled = False ' Disable timer methdo dispatch
cmd_Toggle.Caption = START_CAPTION ' Change command button caption
status = fromDSP.DisableChannel(READ_CHANNEL) ' Disable read channel
If status <> SUCCESS Then ' verify that channel is disabled
response = MsgBox("Error: Disabling the channel " + _
READ_CHANNEL + " Failed", vbCritical)
Exit Sub
End If
status = fromDSP.Close ' Close the read channel
' Was the closing of the read channel successful?
If (status <> SUCCESS) Then
response = MsgBox("Error: Closing of the " + READ_CHANNEL + _
" channel failed", vbCritical)
End If
Set fromDSP = Nothing ' Release the reference to the RTDX Exported
' Interface
status = toDSP.DisableChannel(WRITE_CHANNEL) ' Disable write channel
If status <> SUCCESS Then ' verify that channel is disabled
response = MsgBox("Error: Disabling the channel " + _
WRITE_CHANNEL + " Failed", vbCritical)
Exit Sub
End If
status = toDSP.Close ' Close the write channel
' Was the closing of the write channel successful?
If (status <> SUCCESS) Then
response = MsgBox("Error: Closing of the " + WRITE_CHANNEL + _
" channel failed", vbCritical)
End If
Set toDSP = Nothing ' Release the reference to the RTDX Exported
' Interface
End Sub
Public Sub Clear_Charts()
'#######################################################################
' This procedure is called by the procedure, Form_Load, and procedure,
' Test_On. Its job is to erase the current signal on chart.
'#######################################################################
Dim i As Integer ' index variable for loop
For i = 1 To (SAMPLE_SIZE)
TransmittedSignal.Row = i ' set focus to row number i
TransmittedSignal.Data = 0 ' clear data at row
ReceivedSignal.Row = i
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -