当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·    »显示摘要«
    摘要: _connectionptr怎么用 ......
    摘要: 不够再给分!!! manyqs@163.com ......


求解一个窗口通讯读取数据问题

在串口接受到的一帧数据中,时间占用4个字节,进位方式采用8421码,低位在前,高位在后,最低位代表1毫秒,其中毫秒12位,秒7位,分7位,小时6位,怎么样从中提取出时间信息?请各位帮忙一下!

NO.1   作者: Yans

接收数据缓冲区:buf[4];  
   
  char   tmp[2];  
  tmp[0]   =   buf[0];  
  tmp[1]   =   (buf[1]&0xf0)>>4;  
  short   ms=*(short*)tmp;   //   毫秒  
   
  tmp[0]   =   buf[1]&0x0f|(buf[2]>>5);  
  short   se   =   tmp[0];   //   秒  
   
  tmp[0]   =   (buf[2]&0x1f)|(buf[3]&0xc0);  
  short   m   =   tmp[0];  
  short   h   =   buf[3]&0x3f;  
   
  大概就是这样,具体调试一下就行了!  
   
 


 ·mssql7.0企业版不能装,为什么    »显示摘要«
    摘要: 我的操作系统是win2000,安装mssql7.0/enterprise edition的时候提示"the enterprise edition server component can not be installed on windows nt server using this cd, only client components will be available for......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE