您的位置:程序门 -> vb ->



高手帮看地磅接收程序!分不多,在线等!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


高手帮看地磅接收程序!分不多,在线等![无满意答案结贴,结贴人:joling123]
发表于:2007-11-07 16:35:42 楼主
数据为9位ascii码方式输出,每帧数据共有9组组成(包括小数点),每组数据由10位组成,第一位为起始位第十位为停止位,中间8位为数据位,数据传送先低位后高位,每帧数据间有一组是分隔符“=”,重为89.03,数据连续发送30.98000=30.98000=.........   程序如下:(但是出来的是乱码)
private   sub   command1_click()   '开始接收  
        label1.caption   =   ""
        strwight   =   ""
                with   mscomm1
                        if   .portopen   then
                                .portopen   =   false
                        end   if
                                .commport   =   1
                                .settings   =   "2400,n,8,1   "
                                '.inputlen   =   1
                                .inbuffersize   =   1024
                                .inputmode   =   cominputmodetext
                              '   .inputmode   =   cominputmodebinary
                                .rthreshold   =   9
                                .portopen   =   true
                end   with
end   sub

private   sub   mscomm1_oncomm()
    dim   bytinput()   as   byte
    dim   intinputlen   as   integer
        select   case   me.mscomm1.commevent
                case   comevreceive
                        '此处添加处理接收的代码
                        'intinputlen   =   me.mscomm5.inbuffercount
                        strdata   =   me.mscomm1.input
                        dim   i   as   integer
                        label1.caption   =   strdata
                        if   len(strdata)   =   9   and   mid(strdata,   9,   1)   =   "="   then
                                label1.caption   =   strreverse(strdata)
                        end   if
                        strdata   =   ""
        end   select
end   sub

private   sub   command2_click()     '停止接收
        if   mscomm1.portopen   =   true   then
                mscomm1.portopen   =   false
        end   if
end   sub

下面是用超级终端读出来的前部份资料(前面是乱码最后面也是乱码只有中间的不会):
hyperterminal   1.0   --   hyperterminal   data   file
please   do   not   attempt   to   modify   this   file   directly.


                                                                                                                                                                                                                                                                                                                           e                 xv4               h     d                                                                                                                                        ansi   ?   鴙,   ?tg新建连接                                                                                                                                                                                                &                        稦tg       &            灶      鴙,          搭   *                     茴   稦tg       *            x_   鴙,   `_        茴   ?tg鴙,      -dsg       *            x_   "   <       ?                                                新宋体                                                     #                                          $          d       a          v       b          0316   c            d          衭!zf                 g                  h          com1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         q            r                 )              *              2?     =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0                                                                                                                                                                                                                                                                                                                                  
  -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0                                                                                                                                                                                                                                                                                                                                  
  0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0                                                                                                                                                                                                                                                                                                                                  
  0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .                                                                                                                                                                                                                                                                                                                                  
  0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0                                                                                                                                                                                                                                                                                                                                  
  .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5                                                                                                                                                                                                                                                                                                                                  
  0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0                                                                                                                                                                                                                                                                                                                                  
  5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =                                                                                                                                                                                                                                                                                                                                  
  0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -  
  =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0  
  -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0  
  0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0  
  0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   0   .   0   0   0   -   =   0   5   4   .   0   0   0   0   =   0   0   0   .   1   0   0   0  
发表于:2007-11-07 16:38:471楼 得分:0
option   explicit  
dim   strwight   as   string  
dim   sum   as   integer  
dim   strdata   as   string  

private   sub   command1_click()   '开始接收  
label1.caption   =   ""  
strwight   =   ""  
with   mscomm1  
if   .portopen   then  
.portopen   =   false  
end   if  
.commport   =   1  
.settings   =   "2400,n,8,1   "  
'.inputlen   =   1  
.inbuffersize   =   1024  
.inputmode   =   cominputmodetext  
'   .inputmode   =   cominputmodebinary  
.rthreshold   =   9  
.portopen   =   true  
end   with  
end   sub  
发表于:2007-11-08 16:13:542楼 得分:0
招聘兼职(网上市场调研专员)  

职位类型:兼职  
招聘人数:不限  
公司介绍:本公司是一家专业的市场调研服务公司,协助各大国际市场调研公司在中国招聘网上市场调研专员。  
岗位要求:诚实,有耐心!从事过市场调查方面工作的优先。  
工作内容:我们会通过电子邮件,不定期发送调查问卷给调研专员,调研专员自己安排时间填写问卷就可以了。收入按完成问卷的数量计算,每份20分钟的问卷报酬大约为10元。  

详情请访问:http://www.freesurvey.net.cn?source-9f4cdf18-6995-457a-8f13-800046345882(注册用户后可联系我本人)  
qq咨询       :86037127  
电子邮件:bvtc_lgy@163.com
发表于:2007-11-08 17:04:063楼 得分:0
up
发表于:2007-11-09 09:43:244楼 得分:0
自己顶!!!
发表于:2007-11-12 11:36:185楼 得分:0
没人理我?


快速检索

最新资讯
热门点击