VB中关于调用子程序的问题

PrivateSubTimer1_Timer()Dimbuffer$'SendGetAIcommandtoADAM-4011Moduleataddress01H.MSCo... Private Sub Timer1_Timer()
Dim buffer$
' Send Get AI command to ADAM-4011 Module at address 01H.
MSComm1.Output = "$016" & Chr$(13)
' Wait for data to come back to the serial port.
Do
DoEvents
buffer$ = buffer$ & MSComm1.Input
Loop Until InStr(buffer$, vbCr)
' Read the response till the carriage return character.
Text1.Text = buffer$' Display the reading.
databit$ = Mid(databit$, 5, 1)
End Sub怎样在上面调用下面的这个子程序?Public Function H2B(ByVal Hex As String) As String
Dim i As Long
Dim b As String
i = databit$
Hex = UCase(Hex)
For i = 1 To Len(Hex)
Select Case Mid(Hex, i, 1)
Case "0": b = b & "0000"
Case "1": b = b & "0001"
Case "2": b = b & "0010"
Case "3": b = b & "0011"
Case "4": b = b & "0100"
Case "5": b = b & "0101"
Case "6": b = b & "0110"
Case "7": b = b & "0111"
Case "8": b = b & "1000"
Case "9": b = b & "1001"
Case "A": b = b & "1010"
Case "B": b = b & "1011"
Case "C": b = b & "1100"
Case "D": b = b & "1101"
Case "E": b = b & "1110"
Case "F": b = b & "1111"
End Select
Next i
While Left(b, 1) = "0"
b = Right(b, Len(b) - 1)
Wend
H2B = b
Text2.Text = b
End Function
怎样调用下面的子程序?
展开
 我来答
百度网友b32a2aeee
2015-08-19 · 超过34用户采纳过TA的回答
知道答主
回答量:66
采纳率:0%
帮助的人:48万
展开全部

你这是函数,不是子程序

调用方式和系统函数一样

aa="abdec"
bb=H2B(aa)
追问
aa="abdec"是什么意思?
追答
一个字符串而已,因为你的函数的输入要求字符串,我这里给你一个字符串为例
函数是实现将十六进制的数转换成二进制,你尝试一下就知道了
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式