24小时热门版块排行榜    

Znn3bq.jpeg
查看: 1066  |  回复: 5
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

jiashaoxiong

木虫 (正式写手)

[交流] 【求助】VB问题

VB的一段程序
CODE:
DoEvents
        
        DoEvents
        For j = 1 To hnum
        Sleep (300)
        cmd = "HARM" + str(Harmset(j)) + Chr(13)
        flag = ibwrt(8, cmd, Len(cmd))
        Sleep (300)
        cmd = "SENS " + str(senset(1, j)) + Chr(13)
        flag = ibwrt(8, cmd, Len(cmd))
        Sleep (1000)
        cmd = "OFLT 7" + Chr(10)
        flag = ibwrt(8, cmd, Len(cmd))
        Call stab
        For i = 1 To fnum
        Sleep (500)
        cmd = "SENS " + str(senset(i, j)) + Chr(13)
        flag = ibwrt(8, cmd, Len(cmd))
        Sleep (500)
        cmd = "FREQ" + str(Freqset(i)) + Chr(13)
        flag = ibwrt(8, cmd, Len(cmd))
        Call stab
        cmd = "OUTP ? 3" + Chr(13)
        flag = ibwrt(8, cmd, Len(cmd))
        Sleep (1000)
        flag = ibrd(8, cmd, 48)
        Sleep (500)
        r(i, j) = Val(cmd)
        Sleep (500)
        cmd = "OUTP ? 4" + Chr(13)
        flag = ibwrt(8, cmd, Len(cmd))
        Sleep (1000)
        flag = ibrd(8, cmd, 48)
        Sleep (500)
        th(i, j) = Val(cmd)
     
        If r(i, j) > 0.8 * range(senset(i, j)) Then
         senset(i, j) = senset(i, j) + 1
         ElseIf r(i, j) < 0.1 * range(senset(i, j)) Then
         If senset(i, j) > 11 Then
            senset(i, j) = senset(i, j) - 1
         End If
        End If
        
    Next i
  
    Next j
    cmd = "temp?    " + Chr(10)
        Sleep (300)
        flag = ibwrt(7, cmd, Len(cmd))
        Sleep (300)
        flag = ibrd(7, cmd, 48)
        v = Val(cmd)

可否解释一下这程序是啥意思?

[ Last edited by nono2009 on 2010-10-30 at 15:28 ]
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

刘昭然

新虫 (小有名气)

加油!

jiashaoxiong(金币+1): 2010-12-11 09:37:23
我也是新手,学习啦
6楼2010-12-11 08:42:22
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 6 个回答

gcssg1

金虫 (小有名气)

jiashaoxiong(金币+1): 2010-12-11 09:36:49
我是初学者,无能为力啊
心事浩茫连广宇,于无声处听惊雷
2楼2010-10-28 21:02:07
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

recen

木虫 (文坛精英)

宅!宅!宅!宅出韭菜来

优秀版主


nono2009(金币+1):鼓励交流 2010-10-30 15:29:39
jiashaoxiong(金币+5): 2010-12-11 09:37:13
这个类似于伸出一条腿让别人猜自己的名字了.(这只是可能)
这里有以下自定义的函数或过程:

函数:共 6 个,如下;
Harmset、ibwrt、senset、Freqset、ibrd、range

过程:共 1 个,如下;
stab

常量:8、7、0.8、0.1、11

不知道这些东西的意思,还不敢乱猜
3楼2010-10-29 12:40:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jiashaoxiong

木虫 (正式写手)

nono2009:编辑内容 2010-10-30 15:29
nono2009:建议通使用“引用回复该帖”,不然别人收不到你的回复提示。 2010-10-30 15:29:30
这个确实是一个程序的一部分,不过整个的太多。
CODE:
Declare Function ibinit Lib "gpib.dll" (ByVal ioport As Long, ByVal myaddr As Long, ByVal syscfg As Long) As Long
Declare Function ibwrt Lib "gpib.dll" (ByVal nAddr As Long, ByVal str As String, ByVal ustrlen As Long) As Long
Declare Function ibrd Lib "gpib.dll" (ByVal nAddr As Long, ByVal str As String, ByVal ustrlen As Long) As Long
Declare Function ibifc Lib "gpib.dll" () As Long
Declare Function ibeol Lib "gpib.dll" (ByVal nAddr As Long, ByVal nOEolMode As Long, ByVal pOEolStr As String, ByVal nOEolStrLen As Long, ByVal nIEolMode As Long, ByVal nIEolByte As Long) As Long
Declare Function ibdclr Lib "gpib.dll" (ByVal nAddr As Long) As Long
Declare Function ibllo Lib "gpib.dll" () As Long
Declare Function iblocal Lib "gpib.dll" (ByVal nAddr As Long) As Long
Declare Function ibppl Lib "gpib.dll" () As Long
Declare Function ibpplc Lib "gpib.dll" (ByVal nAddr As Long, ByVal nCfg As Long) As Long
Declare Function ibpplu Lib "gpib.dll" (ByVal nAddr As Long) As Long
Declare Function ibren Lib "gpib.dll" (ByVal nAddr As Long) As Long
Declare Function ibspl Lib "gpib.dll" (ByVal nAddr As Long) As Long
Declare Function ibsts Lib "gpib.dll" (ByVal nCfg As Long) As Long
Declare Function ibtout Lib "gpib.dll" (ByVal uTimeIntvl As Long) As Long
Declare Function ibtrg Lib "gpib.dll" (ByVal nAddr As Long) As Long
Declare Function ibcmd Lib "gpib.dll" (ByVal str As String, ByVal leng As Long) As Long
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Public temperature As Single
Public tstart As Single
Public tstop As Single
Public tstep As Single
Public timestart As Single
Public timenow As Single

Public cmd As String * 96
Public r(1 To 4, 1 To 4) As Single
Public th(1 To 4, 1 To 4) As Single
Public range(0 To 25) As Single
Public Freqset(1 To 4) As Single
Public Harmset(1 To 4) As Integer
Public fnum As Integer
Public hnum As Integer
Public senset(1 To 4, 1 To 4) As Integer
这是一些函数声明。
这是一个过程:
Sub stab()

Sleep (300)
cmd = "OFLT 9" + Chr(10)
flag = ibwrt(8, cmd, Len(cmd))
Sleep (2000)
Sleep (2000)
Sleep (2000)

End Sub

这个是一个通过GPIB控制电流表测电流的一部分程序。

[ Last edited by nono2009 on 2010-10-30 at 15:29 ]
4楼2010-10-29 16:02:28
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 生物学调剂 +10 纸扇zhishan 2026-04-13 10/500 2026-04-18 21:19 by zqndavala
[考研] 297,工科调剂? +5 河南农业大学-能 2026-04-14 5/250 2026-04-18 15:17 by Equinoxhua
[考研] 260求调剂 +4 Zyt1314520.. 2026-04-17 5/250 2026-04-18 08:28 by babysonlkd
[考博] 申博/考博 +3 啃面包的小书虫 2026-04-17 4/200 2026-04-17 23:54 by 阳阳阳^_^
[考研] 化工学硕294分,求导师收留 +33 yzyzx 2026-04-12 37/1850 2026-04-17 23:00 by wunaiy88
[考研] 求调剂 +9 小聂爱学习 2026-04-16 11/550 2026-04-17 22:34 by chixmc
[考研] 一志愿华中农业071010,320求调剂 +17 困困困困坤坤 2026-04-14 19/950 2026-04-17 20:08 by 关一盏灯cd
[考研] 295分求调剂 +5 ?要上岸? 2026-04-17 5/250 2026-04-17 16:51 by fenglj492
[考研] 0854求调剂 +21 门路摸摸 2026-04-15 25/1250 2026-04-17 15:45 by qzxyhcsy
[考研] 279求调剂 +13 张番茄不炒蛋 2026-04-11 13/650 2026-04-17 10:38 by cuisz
[考研] 291求调剂 +9 关忆北. 2026-04-14 9/450 2026-04-16 22:49 by cfdbai
[考研] 材料相关专业344求调剂双非工科学校或课题组 +23 hualkop 2026-04-12 25/1250 2026-04-16 22:12 by SUSE_CL
[考研] 294求调剂 +14 淡然654321 2026-04-15 14/700 2026-04-16 21:01 by lpl364211
[考研] 297,工科调剂? +10 河南农业大学-能 2026-04-14 10/500 2026-04-15 21:50 by noqvsozv
[考研] 一志愿A区211,22408 321求调剂 +6 随心所欲☆ 2026-04-15 7/350 2026-04-15 21:45 by lbsjt
[考研] 各位老师好,求调剂,本科211,一志愿天津大学生物与医药学硕,差两名录取。 +11 路六六jjj 2026-04-13 11/550 2026-04-14 16:01 by zs92450
[教师之家] 转长聘了 +7 简单化xn 2026-04-13 7/350 2026-04-14 14:50 by xindong
[考研] 一志愿中南大学 0855 机械 286 求调剂 +11 不会吃肉 2026-04-12 11/550 2026-04-13 21:59 by bljnqdcc
[考研] 290求调剂 +18 柯淮然 2026-04-12 20/1000 2026-04-13 12:56 by cyh—315
[考研] 一志愿085802 323分求调剂 +13 drizzle_9 2026-04-12 14/700 2026-04-13 10:26 by Faiz5552
信息提示
请填处理意见