aodma2.frm

来自「16 relay output channels and 16 isolated」· FRM 代码 · 共 117 行

FRM
117
字号
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form frmRun 
   Caption         =   "Advantech Demo: Converting & transfering data"
   ClientHeight    =   1830
   ClientLeft      =   3015
   ClientTop       =   2445
   ClientWidth     =   4860
   ControlBox      =   0   'False
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   1830
   ScaleWidth      =   4860
   Begin VB.Timer FAoChkTmr 
      Enabled         =   0   'False
      Left            =   360
      Top             =   960
   End
   Begin VB.CommandButton Command1 
      Caption         =   "&Terminal"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1440
      TabIndex        =   0
      Top             =   960
      Width           =   2175
   End
   Begin ComctlLib.ProgressBar ProgressBar1 
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   240
      Width           =   4455
      _ExtentX        =   7858
      _ExtentY        =   661
      _Version        =   327682
      Appearance      =   1
   End
End
Attribute VB_Name = "frmRun"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
  Unload frmRun
End Sub

Private Sub FAoChkTmr_Timer()
Dim iRet As Integer
Dim ptAoCheck As PT_FAOCheck
Dim lStopped As Long
Dim lCurrentCount As Long
Dim lOverrun As Long
Dim lHalfReady As Long
Dim lActiveBuf As Long

    ptAoCheck.ActiveBuf = DRV_GetAddress(lActiveBuf)
    ptAoCheck.stopped = DRV_GetAddress(lStopped)
    ptAoCheck.CurrentCount = DRV_GetAddress(lCurrentCount)
    ptAoCheck.Overrun = DRV_GetAddress(lOverrun)
    ptAoCheck.HalfReady = DRV_GetAddress(lHalfReady)

    ErrCde = DRV_FAOCheck(DeviceHandle, ptAoCheck)
    If (ChkErr(ErrCde)) Then
       FAoChkTmr.Enabled = False
       Exit Sub
    End If
    
    If (lCurrentCount = 0) Then
       lCurrentCount = 1
    End If
    ProgressBar1.value = lCurrentCount - 1
    
    If lStopped = 1 Then
        Unload frmRun

    End If
    
End Sub


Private Sub Form_Load()
  FAoChkTmr.Interval = 50
  FAoChkTmr.Enabled = True
  ProgressBar1.Max = Val(frmSelDev.DataCounts)
End Sub


Private Sub Form_Unload(Cancel As Integer)

    'Free used resource
    ErrCde = DRV_FreeDMABuffer(DeviceHandle, DRV_GetAddress(glDmaBufPtr))

    '{Stop high speed D/A conversion}
    ErrCde = DRV_FAOTerminate(DeviceHandle)

    'Close device
    DRV_DeviceClose (DeviceHandle)

    FAoChkTmr.Enabled = False
End Sub


⌨️ 快捷键说明

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