在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

    
    
    <address id="vxupu"><td id="vxupu"></td></address>

      <pre id="vxupu"><small id="vxupu"></small></pre>
      <dfn id="vxupu"></dfn>
      <div id="vxupu"><small id="vxupu"></small></div>
    1. 新聞中心

      EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應用 > SLE4442卡_IC的51單片機驅(qū)動程序

      SLE4442卡_IC的51單片機驅(qū)動程序

      作者: 時間:2016-12-02 來源:網(wǎng)絡 收藏

      void Byte_WRT(uchar Xdata) //寫字節(jié)
      {
      uchar count;
      DATA_OUT;
      DelayUs(2);
      for(count=8;count!=0;count--)
      {
      CLK_LOW;
      DelayUs(2);
      if((Xdata)&0x01)
      {
      DATA_HIGH;
      }
      else
      {
      DATA_LOW;
      }
      DelayUs(2);
      CLK_HIGH;
      DelayUs(2);
      Xdata = Xdata >> 1; //循環(huán)右移,從最低位開始寫
      }
      }

      本文引用地址:http://www.biyoush.com/article/201612/324690.htm


      void Command(uchar command,uchar address,uchar IC_data)
      {
      Start();
      Byte_WRT(command); //發(fā)送命令
      Byte_WRT(address); //發(fā)送地址
      Byte_WRT(IC_data); //發(fā)送數(shù)據(jù)
      Stop(); //操作命令結(jié)束
      }

      void Process(void)
      {
      uint j; //寫指令后的處理過程
      DATA_OUT;
      DelayUs(2);
      CLK_LOW;
      DATA_LOW;
      DelayUs(2);
      for(j = 0;j < 255;j++)
      {
      CLK_HIGH;
      DelayUs(2);
      CLK_LOW;
      DelayUs(2);
      }
      DATA_HIGH;
      }

      void Process2(void)
      {
      uint j; //寫指令后的短處理過程
      DATA_OUT;
      DelayUs(2);
      CLK_LOW;
      DATA_LOW;
      DelayUs(2);
      for(j = 0;j < 2;j++)
      {
      CLK_HIGH;
      DelayUs(2);
      CLK_LOW;
      DelayUs(2);
      }
      DATA_HIGH;
      }

      uchar Code_Check(uchar Code1,uchar Code2,uchar Code3) //密碼校驗函數(shù)
      {
      uchar i;
      Command(0x31,0x00,0x00);
      for(i = 0;i < 4;i++)
      {
      ErrorCount[i] = Byte_Read();
      }
      if(ErrorCount[0] == 0)
      {
      return 0;
      }
      else
      {
      if((ErrorCount[0]&0x01) == 1)
      {
      ErrorCount[0] &= 0x06; //bit0=0;
      }
      else if((ErrorCount[0]&0x02) == 1)
      {
      ErrorCount[0] &= 0x05; //bit1=0;
      }
      else
      {
      ErrorCount[0] &= 0x03; //bit2=0
      }
      }
      Command(0x39,0x00,ErrorCount[0]);
      Process();

      Command(0x33,0x01,Code1);
      Process2();

      Command(0x33,0x02,Code2);
      Process2();

      Command(0x33,0x03,Code3);
      Process2();

      Command(0x39,0x00,0xff);
      Process();

      Command(0x31,0x00,0x00);
      for(i = 0;i < 4;i ++)
      {
      ErrorCount[i] = Byte_Read();
      }
      if(ErrorCount[0] == 0x07)
      {
      return 1;
      }
      else
      {
      return 0;
      }
      }


      void ReadMainROM(uchar addr,uchar *p,uchar N) //讀主存區(qū)
      {
      Command(0x30,addr,0xff);
      while(N--)
      {
      *p=Byte_Read();
      p++;
      }
      }



      評論


      技術(shù)專區(qū)

      關(guān)閉