| 发表于:2007-08-13 17:47:11 楼主 |
private sub command1_click() dim out1 as string out1 = chr(2) & "ab03 " & chr(3) mscomm1.output = out1 end sub private sub form_load() mscomm1.portopen = true end sub private sub mscomm1_oncomm() dim mz as string dim pz as string dim jz as string dim i as integer dim rfrom as integer dim rend as integer dim strtemp as string dim strend as string if mscomm1.commevent = 2 then rc = mscomm1.input rc = trim$(rc) if len(rc) > 12 then for i = 1 to len(rc) strtemp = mid$(rc, i, 1) if strtemp = chr(2) then rfrom = i end if if strtemp = chr(3) then rend = i if rend > rfrom then strend = mid$(rc, rfrom, rend - rfrom) 'rc = strconv(rc, vbunicode) mz = mid$(rc, 4, 4) pz = mid$(rc, 8, 3) jz = mz & ". " & pz label2.caption = jz end if end if next i end if end if end sub 是一个采集地磅数据的程序,用232直接连接可以通讯,采用232转485就不行了,mscomm1.output = out1执行后,就没反应了.请高手指教..... |
|
|
|
|