dfkt.net
当前位置:首页 >> 主板上面有Com1,Com2,485口,我想编写vB程序通过4... >>

主板上面有Com1,Com2,485口,我想编写vB程序通过4...

485口的配套口是RS232,所以编写的代码与RS232数据传输相同 我不久前写了一段相关代码,你看是否有用:用MSCOMM控件通信的 Private Sub initcom() 串口初始化程序块 MSComm1.CommPort = 1 '选用com1串行口 MSComm1.Settings = "9600,N,8,1" '波特率...

前面的回答已经说明了,组合框,不知道组合框的话去看看VB的基础教程。

1: Dim i As Integer Dim s As Double Dim s0 As Double For i = 1 To 100 s0 = 1 / i If i Mod 2 = 0 Then s0 = s0 * (-1) s = s + s0 Next Print s 2: Dim i As Integer Dim s As Double For i = 1 To 100 Step 2 s = s + 1 / i - 1 / (i + 1)...

sum =0 for i=1 to 10 jc=1 for j=1 to i jc=jc*j next if i mod 2 =0 then sum=sum-jc eles sum=sum+jc end if next print sum '结果在sum中

正常情况连接设备了才可以看出来。 没连接设备是无法查看的。 可以到设备管理器,右键com口属性,查看下是否有不同。

去 设备管理器 看看 COM3,COM4 属性 看看能不能 改成 COM1,COM2 如果 不能 就 只能换 都有 COM1,COM2 的 电脑了 DELL 380 390 都带有 一个 COM 口

新建form1,在form1里增加cmd1: 代码: Private Sub cmd1_Click() Dim a, b, c, d As Integer Dim x As String For a = 1 To 4 For b = 1 To 4 For c = 1 To 4 For d = 1 To 4 If a b And a c And a d And b c And b d And c d Then x = a & b & ...

如图

Private Sub Command1_Click() Print "第3题:"; Dim n As Integer, s As Double n = InputBox("n=", , 50) For i = 1 To n s = s + 1 / i Next i Print "Sum(" & n & ")="; Format(s, "0.00")End SubPrivate Sub Command2_Click() Print "第4题...

private sub form_click() dim i as integer, t as integer, sum as ingle sum=__0_ 求和变量的初始值0 t =__-1__ 求和数的第一个是正数,与for循环的-1相乘=1 for i =1 to _100__ 需要求和的数有100个 t = t*-1 正负符号交替 sum = sum +__t/i_...

网站首页 | 网站地图
All rights reserved Powered by www.dfkt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com