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

📄 ua303.frm

📁 数模转换程序
💻 FRM
📖 第 1 页 / 共 2 页
字号:
  '   Else
       Picture2.Print " CHANNEL :"; wch; ","; wch + 1; "            WAVE DISPLAY", "        SAMP_Fr."; fr(kf) / 10; " KHz"
     
     End If


End Sub

Private Sub Form_Click()
'  MessageBeep (0)
'  hh = (hh + 1) And 1
End Sub

Private Sub Form_Load()
  Dim i As Integer
  
  husb = OpenUA300()
  If husb = 0 Then
     i = MsgBox(" 设备打开错误!!! ", 0, "警告!")
  End If
  t11 = 1
  y0 = Picture1.ScaleHeight / 10
  yd = 2048 / (y0 - 50)
  datp = 516
  mch = 0: dispchn = 1
  kf = 1
  fr(0) = 250       '25k
  fr(1) = 200       ' 20k
  fr(2) = 100       ' 10k
  fr(3) = 50        ' 5k
  fr(4) = 20        ' 2k
  fr(5) = 10        ' 1k
  fcode1 = 60000 / fr(kf)
  fcode = fcode1
  fx = 0: hh = 0
  Picture1.AutoRedraw = False
  Picture3.AutoRedraw = False

form1.Caption = "UA303 数据采集器 Ver" + Hex$(GetVer(husb))

mmch = 1
minit husb, 2, 1, 0


End Sub

Private Sub Form_Resize()
  Dim fmw As Integer
  Dim fmh As Integer
  fmw = form1.ScaleWidth
  fmh = form1.ScaleHeight


  Picture1.Width = fmw - (6885 - 5895)
  If Picture1.ScaleWidth < 6000 Then datp = 400 Else datp = 750
  Picture2.Width = fmw - (6885 - 5895)
  Picture3.Width = fmw - (6885 - 5895)
  
  mysub1

  cmdend.Left = fmw - 765
  cmdfr.Left = fmw - 765
  cmdqx.Left = fmw - 765
  cmdch.Left = fmw - 765
  cmdgain.Left = fmw - 765
  
  cmdch.Top = fmh - 1005
  cmdfr.Top = fmh - 1965
  cmdend.Top = fmh - 525
  cmdqx.Top = fmh - 1485
  cmdgain.Top = fmh - 2445

  Option1.Left = fmw - 800
  Option2.Left = fmw - 800
  Option1.Top = form1.ScaleTop + 500
  Option2.Top = form1.ScaleTop + 800

             
   If fx% = 1 Then
     Picture2.Cls
     Picture2.Print "   CH"; fch,
     Picture2.Print "   CH"; fch + 1,
     Picture2.Print "   CH"; fch + 2,
     Picture2.Print "   CH"; fch + 3,
     Picture2.Print "   CH"; fch + 4,
     Picture2.Print "   CH"; fch + 5,
     Picture2.Print "   CH"; fch + 6,
     Picture2.Print "   CH"; fch + 7
   Else
     If mch = 0 Then
   '     Picture2.Print " CHANNEL :"; wch; "               WAVE DISPLAY", "        SAMP_Fr."; fr(kf) / 10; " KHz"
   '  Else
        Picture2.Print " CHANNEL :"; wch; ","; wch + 1; "            WAVE DISPLAY", "        SAMP_Fr."; fr(kf) / 10; " KHz"

     End If

     
   End If
End Sub

Private Sub mysub1()
  Dim p1h As Integer
  Dim p3h As Integer

  Picture1.Height = (form1.ScaleHeight - 510) / dispchn
  Picture3.Top = Picture1.Top + Picture1.Height
  y0 = Picture1.ScaleHeight / 10
  yd = 2048 / (y0 - 50)
  
  If mch = 0 Then
    Picture3.Height = 0
  Else
    Picture3.Height = Picture1.Height
    Picture3.AutoRedraw = True
    Picture3.Cls
  End If
                
  p1h = Picture1.ScaleHeight
  p3h = Picture3.ScaleHeight
                                        
     Picture1.AutoRedraw = True
     Picture1.Cls
     For i = 0 To 11
       For j = 0 To Picture1.ScaleWidth Step 45
         Picture1.PSet (j, 25 + i * (p1h - 50) / 10), RGB(0, 0, 0)
       Next
     Next
     If mch = 1 Then
       For i = 0 To 11
         For j = 0 To Picture1.ScaleWidth Step 45
           Picture3.PSet (j, 25 + i * (p3h - 50) / 10), RGB(0, 0, 0)
         Next
       Next
     End If
     

     Picture1.Line (0, 25 + 0.2 * (p1h - 50))-(Picture1.ScaleWidth, 25 + 0.2 * (p1h - 50)), RGB(0, 0, 0)
     Picture1.Line (0, 25 + 0.4 * (p1h - 50))-(Picture1.ScaleWidth, 25 + 0.4 * (p1h - 50)), RGB(0, 0, 0)
     Picture1.Line (0, 25 + 0.6 * (p1h - 50))-(Picture1.ScaleWidth, 25 + 0.6 * (p1h - 50)), RGB(0, 0, 0)
     Picture1.Line (0, 25 + 0.8 * (p1h - 50))-(Picture1.ScaleWidth, 25 + 0.8 * (p1h - 50)), RGB(0, 0, 0)
     
     Picture1.AutoRedraw = False
     If mch = 1 Then
       Picture3.Line (0, 25 + 5 * (p3h - 50) / 10)-(Picture3.ScaleWidth, 25 + 5 * (p3h - 50) / 10), RGB(0, 0, 0)
       Picture3.AutoRedraw = False
     End If


     Picture1.PSet (0, -dd1(0) / yd + y0)
     Picture3.PSet (0, -dd1(0) / yd + y0)
     For i = 0 To datp - 2
       Picture1.Line -(i * 15, -dd1(i) / yd + y0)
       If mch = 1 Then
         Picture3.Line -(i * 15, -dd1(i) / yd + y0)
       End If
     Next
              
              
    wch = 0
    Picture2.Cls
    If mch = 0 Then
 '     Picture2.Print " CHANNEL:"; wch; "               WAVE DISPLAY", "        SAMP_Fr."; fr(kf) / 10; "KHz"
 '   Else
      Picture2.Print " CHANNEL:"; wch; ","; wch + 1; "           WAVE DISPLAY", "       SAMP_Fr."; fr(kf) / 10; "KHz"
    
    End If

'     If mch = 1 Then
'     picture3.PSet (0, -dd1(0) / yd + y0)
'     For i = 0 To datp - 2
'       picture3.Line -(i * 15, -dd1(i) / yd + y0)
'     Next
'     End If

End Sub

Private Sub Option1_Click()
  mch = 0
  dispchn = 1
  mmch = 1
  mysub1
 'minit (fcode)
End Sub

Private Sub Option2_Click()
  mch = 0
  mmch = 4
   dispchn = 1
   mysub1
  ' minit (fcode)

End Sub

Private Sub Picture1_Click()
  hh = (hh + 1) And 1
  Beep
End Sub

Private Sub Timer1_Timer()
Dim ch1 As Integer
Dim i As Long

offset1 = 2048

  If fx = 1 Then
    If hh = 0 Then nn = nn + 1
    If hh1 = 0 And nn < (y0 / 18 - 1) Then '/ 97 + 1) Then
        ch1 = fch
        For i = 1 To 8
          dd = (ssad(husb, ch1, g) - 2048) * 0.002442
          dd = dd / gd
          ee = Format(dd, "00.0000")
          Picture1.Print "  "; ee,
          ch1 = ch1 + 1
          If ch1 > 15 Then ch1 = 0
        Next
      Picture1.Print
    End If
    If nn > y0 / 18 Then '/ 97 + 5 Then
      Picture1.Cls
      nn = 0
    End If
    
  Else
    If hh = 0 Then
      
      If mmch = 1 Then
         minit husb, wch, 2, g
         readdata husb, dd1(0), fcode, 10240
         
      Else
      
        minit husb, wch, 4, g
        readdata husb, dd1(0), fcode, 10240
      
      End If
      
      
     For i = 0 To 20480
        dd1(i) = ((dd1(i) And &HFFF) - 2048)
      Next
  
  
  If mmch = 1 Then
t11 = 1
Picture1.Cls
y0 = Picture1.ScaleHeight / 10
y0 = t11 * 2 * y0 - y0
t11 = t11 + 1
If t11 = 6 Then t11 = 1
       
If g = 0 Then v = 5
If g = 1 Then v = 2.5
If g = 2 Then v = 2.5 / 2
If g = 3 Then v = 2.5 / 4
If g = 4 Then v = 2.5 / 8
'If g = 5 Then v = 2.5 / 8
'If g = 6 Then v = 2.5 / 16
'If g = 7 Then v = 2.5 / 32

Picture1.Print v; "V  "; i1; "Words"
      
  i1 = 0
For i2 = 1 To 5
    i3 = i1 + 1
    Picture1.PSet (0, -Int(dd1(i1)) / yd + y0)
    i3 = i1 + 1
    For i = 0 To Picture1.ScaleWidth - 2 Step Picture1.ScaleWidth / 1024 '(datp) / dispchn - 2
       Picture1.Line -(i, -Int(dd1(i1) / yd + 0.5) + y0), RGB(220, 220, 20)
       i1 = i1 + 2
    Next
    Picture1.PSet (0, -Int(dd1(i3)) / yd + y0)
    For i = 0 To Picture1.ScaleWidth - 2 Step Picture1.ScaleWidth / 1024 '(datp) / dispchn - 2
       Picture1.Line -(i, -Int(dd1(i3) / yd + 0.5) + y0)
       i3 = i3 + 2
    Next

       
   y0 = Picture1.ScaleHeight / 10
   y0 = t11 * 2 * y0 - y0
   t11 = t11 + 1
   If t11 = 6 Then t11 = 1
Next
  
End If
     
  If mmch <> 1 Then
  Picture1.Cls

  i1 = 0
  t11 = 1

     For i2 = 1 To 4
        
y0 = Picture1.ScaleHeight / 10
y0 = t11 * 2 * y0 - y0
t11 = t11 + 1
If t11 = 5 Then t11 = 1
'       If t11 = 1 Then Picture1.Cls
       Picture1.PSet (0, -Int(dd1(i1)) / yd + y0)
       For i = 0 To Picture1.ScaleWidth - 2 Step Picture1.ScaleWidth / 1024 '(datp) / dispchn - 2
         Picture1.Line -(i, -Int((dd1(i1)) / yd + 0.5) + y0), RGB(220, 220, 20)
       i1 = i1 + 4
       Next
       
       i1 = i2

    Next
      
      
      
      
      End If
    
    End If
  End If

330:
End Sub


Private Sub outadb(port%, dat%)
Dim obuff(1) As Byte
Dim ibuff(2) As Byte
ibuff(0) = port
ibuff(1) = dat

lVer = DeviceIoControl(husb, &H222020, ibuff(0), 2, obuff(0), 0, 1, 0)

End Sub

Private Function inadb(port%) As Integer

Dim obuff(1) As Byte
Dim ibuff(1) As Byte

ibuff(0) = port

lVer = DeviceIoControl(husb, &H222024, ibuff(0), 1, obuff(0), 1, 1, 0)

inadb = obuff(0)
End Function

⌨️ 快捷键说明

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