1 / 11
文档名称:

A51程序.doc

格式:doc   大小:50KB   页数:11页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

A51程序.doc

上传人:bjy0415 2019/3/16 文件大小:50 KB

下载得到文件列表

A51程序.doc

文档介绍

文档介绍:/*LSB---低字节位*/  /*MSB---高字节位*/  /* Masks for the three shift registers */  #define R1MASK 0x07FFFF /* 19 bits, numbered 0..18 */  #define R2MASK 0x3FFFFF /* 22 bits, numbered 0..21 */  #define R3MASK 0x7FFFFF /* 23 bits, numbered 0..22 */  /* Middle bit of each of the three shift registers, for clock control */  #define R1MID 0x000100 /* bit 8 */  #define R2MID 0x000400 /* bit 10 */  #define R3MID 0x000400 /* bit 10 */  /* Feedback taps, for clocking the shift registers.  * These correspond to the primitive polynomials  * x^19 + x^5 + x^2 + x + 1,   * x^22 + x + 1,  * x^23 + x^15 + x^2 + x + 1.   */  #define R1TAPS 0x072000 /* bits 18,17,16,13 */  #define R2TAPS 0x300000 /* bits 21,20 */  #define R3TAPS 0x700080 /* bits 22,21,20,7 */  /* Output taps, for output generation */  /* 高位是高字节 */  #define R1OUT 0x040000 /* bit 18 (the high bit) */  #define R2OUT 0x200000 /* bit 21 (the high bit) */  #define R3OUT 0x400000 /* bit 22 (the high bit) */  typedef unsigned char byte;  typedef unsigned long word;  typedef word bit;  /* Calculate the parity of a 32-bit word, . the sum of its bits modulo 2 */  bit parity(word x) {  x ^= x>>16;  x ^= x>>8;  x ^= x>>4;  x ^= x>>2;  x ^= x>>1;  return x&1;  }  /*Above is cool,but why?  int parity(unsigned long ino)  {  int noofones = 0;  unsigned long mask = 0x00000001ul; /* start at first bit */  while(mask != 0) /* until all bits tested */  {  if(mask & ino) /* if bit is 1, increment noofones */  {  noofones++;  }  mask = mask << 1; /* go to next bit */  }  /* if noofones is odd, least significant bit will be 1 */  return (noofones & 1);   }  */  /* Clock one shift register */  word clockone(word reg, word mask, word taps) {  word t = reg & taps;//仅取抽头位,做反馈用  reg = (reg << 1) & mask;//左移一位,&掩码,则表示只取掩码位  reg |= parity(t);//反馈位  return reg;  }  /* The three shift registers. They're in global variables to make the code  * easier to understand.  * A better implementation would not use global vari

最近更新

2025年打篮球作文(精选29篇) 21页

2025年手初一学生作文(共26篇) 37页

2025年房产公司材料采购合同(精选13篇) 32页

2025年期末考试个人总结5篇 12页

2025年我能行四年级作文550字(推荐25篇) 27页

2025年明责任演讲稿优秀6篇 18页

2025年我的母亲-初一作文(精选24篇) 31页

2025年我的村庄随笔散文(精选篇) 49页

2025年我的心儿在告诉我优秀作文(通用篇) 18页

2025年我的小小烦恼小学生作文(通用28篇) 30页

2025年我的好朋友小学四年级优秀作文450字(共.. 25页

2025年我的大学老师作文(共篇) 27页

车辆抵押借款简单合同书范本(2025版) 13页

2025年教师学年个人工作总结6篇 21页

金融贷款居间服务协议书2025年通用 16页

运输分包合同书集合2025年通用 17页

进口医疗器械合同书协议书书范本2025年通用 16页

2025年我的五年级生活作文(集锦21篇) 19页

酒店供货协议书书(2025版) 14页

2025年度无人机应用技术专业人才培养方案 8页

2023年高考全国甲卷地理试卷真题及答案详解 10页

可控缓释尿素颗粒肥料及其制备方法 14页

田间管理记录表(共4页) 4页

嗜铬细胞瘤手术麻醉管理专家共识指南解读(201.. 27页

建筑电气工程施工方案范文 17页

建设社会主义文化强国ppt课件 38页

护理理论第十五章课件 18页

sn t - 进出口锑锭中铅丶铜丶铁丶铋含量的测定.. 17页

民爆器材企业安全检查表 95页