Visual Basic
OS Windows Visual Basic GPIBRS232C A/D Visual Basic Windows Visual Basic Visual Basic Visual Basic Visual Basic Windows GUI( ) OS Visual Basic Form Form 1
Visual Basic Microsoft Visual Basic 6.0 Microsoft Visual Basic6.0 Visual Basic Visual Basic 01 01Visual Basic 02 02 EXE 03 03 2
Form Form Form Form 04 04 3
Visual Basic Form Form 05 05 Form 06 06 4
07 07 Caption 08 08 5
Private SubEnd Sub 09 09 Form Form Form 10 10 6
11 11 7
GPIB GPIB General Purpose Interface Bus IEEE488-1975 IEEE488 1987 IEEE488.2-1987 IEEE488.1-1987 1992 IEEE488.2-1992 IEEE488 IEEE488.1 IEEE488 IEEE488.1 GPIB Windows Windows OS GPIB 13 13 GPIB ADVANTEST R6551 14 14ADVANTEST -8-
GPIB 15 15 GPIB 16 16 GPIB IEEE488.1 IEEE488.2 ADVANTEST 1/2 ASCII ASCII -9-
GPIB GPIB Windows OS OS OS OS 13 GPIB 17 PCMCIA-GPIB 18 17 18-10-
GPIB GPIB Visual Basic Visual Basic GPIB GPIB 19 GPIB 20 19 20GPIB -11-
Form cmddmm Private Sub cmddmm_click() Dim addr As Integer GPIB Dim dmm As Integer Dim rd As String Dim Spol As Integer addr=2 Call ibdev(0, addr, 0, T10s, 1, 0, dmm) GPIB Call ibclr(dmm) GPIB Call ibwrt(dmm, F1,RE5,H1 ) Do Call ibrsp(dmm, Spol) DoEvents Loop While(Spol And 16)=16 rd = Space$(20) Call ibrd(dmm,rd) Dim MyString, Head, DMMData MyString = rd Head = Mid ( MyString, 1, 3 ) Head DMMData = Mid ( MyString, 4, 11 ) DMMData DMM_Data.Text=DMMData GPIB Call ibloc(dmm) End Sub -12-
21 21GPIB 22 22-13-
GPIB NI Call ibdev ibdev GPIB GPIB GPIB GPIB EOI Call ibclr () ibdev Staibclr() ER ibsta Ibsta GPIB Call ibwrt Call ibrsp( ) Call ibrd ibloc -14-
RS232C RS232C R ecommended S tandard E lectronics Industries A ssociation T elecommunications Industries A ssociation EIA/TIA RS Dsub9pin MINI-Wiring Adapter 23 23MINI-Wiring Adapter -15-
TDS210 RS232C 24 24 TDS210 RS232C RS232C Visual Basic -16-
Visual Basic Microsoft Comm Control6.0 25 25 Microsoft Comm Control 6.0 OK 26 26 OK 27 27 MSComm Form 28-17-
28MSComm RS232C TDS210 Form MSComm Private Sub Form_Load() 'MSComm mscport.commport = 1 mscport.settings = "9600,n,8,1" mscport.handshaking = comrts mscport.rtsenable = True mscport.sthreshold = 1 mscport.rthreshold = 1 End Sub 2-18-
Private Sub Form_Unload(Cansel As Integer) ' If mscport.portopen Then mscport.portopen = False End If End End Sub ' Private Sub rsport_click() mscport.portopen = Not mscport.portopen If mscport.portopen = True Then Else End If End Sub rsport.caption = " " rsport.caption = " " LF Private Sub cmddata_click() ' If mscport.portopen = True Then mscport.output = cmdsend.text & Chr(&HA) End If End Sub -19-
Private Static Sub mscport_oncomm() Dim rsbuffer As Variant Dim rsdata, PointData Select Case mscport.commevent Case comevcd Case comevcts Case comevdsr Case comevring Case comevreceive rsbuffer = mscport.input rsdata = rsdata & rsbuffer Case comevsend Case comeveof Case Else MsgBox " ", vbexclamation, " " End Select PointData = Mid(rsData, InStr(rsData, "CURVE ") + 6) txtdata.text = PointData End Sub -20-
Private Sub trdata_click() Dim im As Long Dim i1, i2, i3 As Integer Dim strdata Dim P_Data, posdata Dim pos(30000) As Long Dim intdata(30000) As Long Dim k(10000) im = 1 i1 = 1 i2 = 1 P_Dat = 1 strdata = txtdata.text P_Data = Len(strData) Do While InStr(strData, ",") <> 0 strdata = Mid(strData, InStr(strData, ",") + 1) im = im + 1 Loop strdata = txtdata.text P_Data = Mid(strData, 1, P_Data - 1) posdata = 1 For i1 = 1 To im pos(i1) = InStr(posData + 1, P_Data, ",") posdata = pos(i1) Next i1 pos(im) = Len(P_Data) k(1) = Mid(P_Data, 1, pos(1) - 1) intdata(1) = CInt(k(1)) For i2 = 2 To im - 1 k(i2) = Mid(P_Data, pos(i2-1) + 1, pos(i2) - pos(i2-1) - 1) intdata(i2) = CInt(k(i2)) Next i2 k(im) = Mid(P_Data, pos(im - 1) + 1, pos(im) - pos(im - 1)) intdata(im) = CInt(k(im)) For i3 = 1 To im Print intdata(i3) Next i3 End Sub -21-
RS232C Form Form 29 30 29RS232C Form 30-22-
RS-232C Microsoft Comm Control 6.0 mscport CommPort ~ mscport.commport=1 Settings mscport.settings 9600,n,8,1 Handshaking RTSEnable SThreshold Rthreshold mscport.handshakingcomrts RTS(Request To Send ) mscport.rtsenabletrue oncomm mscport.sthreshold=1 oncomm mscport.rthreshold=1 oncomm CommEvent comevsend oncomm oncomm SThreshold comevreceive RThreshold Input comevcts Clear To Send comevdsr Data Set Ready comevcd High Low Carrier Detect comevring RI comeveof EOFEnd Of File EOF ASCII 26h -23-
PortOpen mscport.portopen=true Output mscport.output=cmdsed.text Input rsbuffer=mscport.input -24-
A/D A/D A/D A/D OS DAQCard-500 31 31DAQCard-500 DAQCard DAQ 32http://www.ni.com/support/jp/daqsupp.htm 32DAQ -25-
DAQCard-500-26-
OS Nidaq69Jpn.exe 33 33 LabVIEW, Visual C++, Borland C++, Borland Delphi, Microsoft Internet Explorer Visual Basic 34 34NI-DAQ 35-27-
A/D A/D 36 36A/D A/D 37 37A/D Form 38A/D -28-
AI_Vread 3000 Picture 39 Private Sub Command1_Click() Dim Vr(5000) As Double For i = 1 To 3001 Call AI_VRead(1, 0, i, Vr(i)) Text1.Text = Vr(i) Next i Dim Y1(5000) As Double Dim X1(5000) As Double Picture1.Cls For i = 1 To 3000 X1(i) = i * 1 Y1(i) = 2000-100 * (Vr(i) + 10) Picture1.Circle (X1(i), Y1(i)), 10 Next i End Sub -29-
DAQCard-500 4 DIG_Out_Port LED 40 Private Sub Command1_Click() Call DIG_Out_Port(1, 0, 15) End Sub Private Sub Command2_Click() Call DIG_Out_Port(1, 0, 0) End Sub -30-