⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s4l2.bas

📁 TMS320c6000系列dsp软件模拟器在集成开发环境CCS中应用实例
💻 BAS
字号:
Option Explicit

'**********************************************************************

'* S4L2.bas - (Section 4, Lesson 2) USING THE FLUSH ROUTINE

'*            This is the RTDX Host Client for Section 4, Lesson 2

'*

'* This example sends 4 bytes to the target and then flushes the

'* channel.

'**********************************************************************



Const Success = &H0                     ' Method call is valid

Const Failure = &H80004005              ' Method call failed

Const ENoDataAvailable = &H8003001E     ' No data was available.

                                        ' However, more data may be

                                        ' available in the future.

Const EEndOfLogFile = &H80030002        ' No data was available

                                        ' The end of the log file has

                                        ' been reached.



Const VALUE_TO_SEND = 5



Sub main()

    

    Dim rtdx As Object

    Dim data As Long

    Dim bufferstate As Long

    Dim status As Long



    On Error GoTo Error_Handler



    ' Create an instance of the RTDX COM object

    Set rtdx = CreateObject("RTDX")



    ' Open channel ichan for writing

    status = rtdx.Open("ichan", "W")



    If status <> Success Then

        Debug.Print "Opening of channel ichan failed"

        GoTo Error_Handler

    End If



    data = VALUE_TO_SEND

    ' send a 32-bit integer to the target

    status = rtdx.WriteI4(data, bufferstate)



    '******************************************************************

    ' Insert code from Step #3 here - to find out if the target has

    '                                 requested data from the host

    '******************************************************************



    status = rtdx.StatusOfWrite(bufferstate)



    If status <> Success Then

        Debug.Print "Error in call to StatusOfWrite"

        GoTo Error_Handler

    End If



    If bufferstate <= 0 Then



        '**************************************************************

        ' Insert code from Step #4 here - to flush the channel

        '**************************************************************



        status = rtdx.Flush()



        If status <> Success Then

            Debug.Print "Error in call to Flush"

            GoTo Error_Handler

        End If

    End If



    If status = Success Then

        Debug.Print "Value " & data & " was sent to the target"

    Else

        Debug.Print "WriteI4 failed"

    End If



    ' Close the channel

    status = rtdx.Close()



    ' Release the reference to the RTDX COM object

    Set rtdx = Nothing

    

    Exit Sub



Error_Handler:

Debug.Print "Error in COM method call"

Set rtdx = Nothing



End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -