<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_TomYu</title><subtitle type="text"/><id>http://feed.cnblogs.com/blog/u/29681/rss</id><updated>2010-11-14T04:53:11Z</updated><author><name>TomYu</name><uri>http://www.cnblogs.com/TomYu/</uri></author><generator>CNBlogs BlogServer</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/TomYu/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/29681/rss"/><entry><id>http://www.cnblogs.com/TomYu/archive/2010/11/14/plc_BCD.html</id><title type="text">【转】关于BCD码</title><summary type="text">在PLC数据转换中经常接触到BCD码，那么什么是BCD码，什么是压缩的BCD码？二者又有什么区别呢？　　在数字系统中，各种数据要转换为二进制代码才能进行处理，而人们习惯于使用十进制数，所以在数字系统的输入输出中仍采用十进制数，这样就产生了用四位二进制数表示一位十进制数的方法，这种用于表示十进制数的二进制代码称为二－十进制代码（Binary Coded Decimal)，简称为BCD码。它具有二进制...</summary><published>2010-11-14T04:53:00Z</published><updated>2010-11-14T04:53:00Z</updated><author><name>TomYu</name><uri>http://www.cnblogs.com/TomYu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/TomYu/archive/2010/11/14/plc_BCD.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/TomYu/archive/2010/11/14/plc_BCD.html"/><content type="html">在PLC数据转换中经常接触到BCD码，那么什么是BCD码，什么是压缩的BCD码？二者又有什么区别呢？&#xD;
&#xD;
　　在数字系统中，各种数据要转换为二进制代码才能进行处理，而人们习惯于使用十进制数，所以在数字系统的输入输出中仍采用十进制数，这样就产生了用四位二进制数表示一位十进制数的方法，这种用于表示十进制数的二进制代码称为二－十进制代码（Binary Coded Decimal)，简称为BCD码。它具有二进制数的形式以满足数字系统的要求，又具有十进制的特点（只有十种有效状态）。在某些情况下，计算机也可以对这种形式的数直接进行运算。常见的BCD码表示有以下几种。&#xD;
&#xD;
8421BCD编码&#xD;
&#xD;
　　这是一种使用最广的BCD码，是一种有权码，其各位的权分别是（从最有效高位开始到最低有效位）8,4,2,1。&#xD;
　　例　写出十进数563.97D对应的8421BCD码。&#xD;
　　　　563.97D=0101 0110 0011 . 1001 01118421BCD&#xD;
　　例　写出8421BCD码1101001.010118421BCD对应的十进制数。&#xD;
　　　　1101001.010118421BCD＝0110 1001 . 0101 10008421BCD=69.58D&#xD;
　　在使用8421BCD码时一定要注意其有效的编码仅十个，即：0000～1001。四位二进制数的其余六个编码1010,1011,1100,1101,1110,1111不是有效编码。&#xD;
&#xD;
2421BCD编码&#xD;
&#xD;
　　2421BCD码也是一种有权码，其从高位到低位的权分别为2,4,2,1，其也可以用四位二进制数来表示一位十进制数。其编码规则如下表。&#xD;
&#xD;
余3码&#xD;
&#xD;
　　余3码也是一种BCD码，但它是无权码，但由于每一个码对应的8421BCD码之间相差3,故称为余3码，其一般使用较少，故正须作一般性了解，具体的编码如下表。&#xD;
&#xD;
常见BCD编码表&#xD;
&#xD;
十进制数 8421BCD码 2421BCD码 余3码 &#xD;
0        0000      0000      0011 &#xD;
1        0001      0001      0100 &#xD;
2        0010      0010      0101 &#xD;
3        0011      0011      0110 &#xD;
4        0100      0100      0111 &#xD;
5        0101      1011      1000 &#xD;
6        0110      1100      1001 &#xD;
7        0111      1101      1010 &#xD;
8        1000      1110      1011 &#xD;
9        1001      1111      1100 &#xD;
10     0001,0000 0001,0000 0100,0011 &#xD;
&#xD;
非压缩式和压缩式：&#xD;
BCD又分为两种，非压缩式和压缩式两种。&#xD;
前面这种81秒存成 “08,01” 是非紧密式，而紧密式会存成 “81h” &#xD;
(直接以十六进制储存)。&#xD;
&#xD;
非压缩的BCD码只有低四位有效，而压缩的BCD码则将高四位也用上了，就是说一个字节有两个BCD码。&#xD;
&#xD;
BCD是用0和1表示十进制，如0000表示0，0001表示1，0010表示2，举例&#xD;
子1234表示成0001001000110100，而压缩的bcd是用00表示0，01表示1，&#xD;
10表示2，110表示3等，但压缩的BCD并不固定，可看情况而定，所要的&#xD;
就是用最少的位数表示尽可能多的数。&#xD;
&#xD;
原文链接：http://blog.gkong.com/more.asp?id=1219&amp;name=zhyo720211&lt;img src="http://www.cnblogs.com/TomYu/aggbug/1876929.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/TomYu/archive/2010/11/14/plc_BCD.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/TomYu/archive/2008/09/19/1293944.html</id><title type="text">SNS网站获取导入MSN联系人的方法</title><summary type="text">刚看到了针对SNS获取MSN好友、各大邮箱联系人，邮件群发解决方案，这篇文章，我也来说说我找到的方法。SNS上通过MSN来推广的方法最近很流行，据说facebook使用微软的msn contact api，这个在msdn上有说明，至今还是1.0beta，没有仔细研究。另一种方法是通过DOTMSN来实现，DOTMSN原本是在winform下用来实现msn聊天机器人的，由于DOTMSN是启动另一个线程...</summary><published>2008-09-19T02:51:00Z</published><updated>2008-09-19T02:51:00Z</updated><author><name>TomYu</name><uri>http://www.cnblogs.com/TomYu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/TomYu/archive/2008/09/19/1293944.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/TomYu/archive/2008/09/19/1293944.html"/></entry><entry><id>http://www.cnblogs.com/TomYu/archive/2008/07/21/1247689.html</id><title type="text">SQL Server 2005异地备份</title><summary type="text">前几天做了数据库镜像，现在也要来做做数据库的备份。本方案采用备份至本地然后copy到文件服务器的方法。</summary><published>2008-07-21T06:42:00Z</published><updated>2008-07-21T06:42:00Z</updated><author><name>TomYu</name><uri>http://www.cnblogs.com/TomYu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/TomYu/archive/2008/07/21/1247689.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/TomYu/archive/2008/07/21/1247689.html"/></entry><entry><id>http://www.cnblogs.com/TomYu/archive/2008/07/18/1245878.html</id><title type="text">从数据库读取数据写入excel并调用Winrar加密压缩输出</title><summary type="text">   参考了园子里一些朋友的文章，在下面的处理方式中仍然存在一些问题，更改excel Application的运行帐户为network Service后可以正常下载，但是excel进程无法正常关闭，也试验了很多种方法，仍然没有最后解决。&#xD;</summary><published>2008-07-18T03:27:00Z</published><updated>2008-07-18T03:27:00Z</updated><author><name>TomYu</name><uri>http://www.cnblogs.com/TomYu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/TomYu/archive/2008/07/18/1245878.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/TomYu/archive/2008/07/18/1245878.html"/></entry><entry><id>http://www.cnblogs.com/TomYu/archive/2008/07/18/1245824.html</id><title type="text">SQL Server 2005 定时从MySQL读取数据</title><summary type="text">最近需要实现这样一个功能，游戏的数据库是MySQL，而我做的统计的数据库是SQL Server 2005，每天需要将多台MySQL的数据统计到SQL Server中，我们知道在SQL Server 2005 中可以才用SQL Server 代理来实现定时操作，但是如何访问MySQL呢？ </summary><published>2008-07-18T02:48:00Z</published><updated>2008-07-18T02:48:00Z</updated><author><name>TomYu</name><uri>http://www.cnblogs.com/TomYu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/TomYu/archive/2008/07/18/1245824.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/TomYu/archive/2008/07/18/1245824.html"/></entry><entry><id>http://www.cnblogs.com/TomYu/archive/2008/07/18/1245774.html</id><title type="text">SQL Server 2005 镜像功能实现</title><summary type="text">这几天为了解决数据库的备份以及出现问题能够在最快的时间内恢复的问题，用到了sql server 2005的数据库镜像功能，参考了园子里一些文章，在局域网测试成功后就在服务器上实施了。&#xD;数据库镜像不一定要在域环境中实施， 由于服务器限制我没有用见证服务器，认证方式采用证书认证，据说采用证书认证是最容易成功的一种方式。&#xD;</summary><published>2008-07-18T02:12:00Z</published><updated>2008-07-18T02:12:00Z</updated><author><name>TomYu</name><uri>http://www.cnblogs.com/TomYu/</uri></author><link rel="alternate" href="http://www.cnblogs.com/TomYu/archive/2008/07/18/1245774.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/TomYu/archive/2008/07/18/1245774.html"/></entry></feed>
