色婷婷AⅤ一区二区三区|亚洲精品第一国产综合亚AV|久久精品官方网视频|日本28视频香蕉

          新聞中心

          atmega16與12864

          作者: 時(shí)間:2016-11-26 來(lái)源:網(wǎng)絡(luò) 收藏
          #include

          #include
          #define uchar unsigned char
          #pragma data:code
          const uchar string1[]="AVR 單片機(jī)12684 ";
          void RDBZ()
          {


          PORTD&=~BIT(4);
          PORTD|=BIT(5);
          PORTD&=~BIT(6);
          DDRA=0XFF;
          PORTA=0XFF;
          PORTD|=BIT(6);
          DDRA=0X00;
          PORTA=0XFF;
          while(PINA&0x80);

          }
          void write_cmd(uchar cmd,uchar buzy)
          {

          if(buzy)
          RDBZ();
          DDRA=0XFF;
          PORTD&=(~BIT(5)&~BIT(4));
          PORTD|=BIT(6);
          PORTA=cmd;
          PORTD&=~BIT(6);
          }
          void delay()
          {
          uchar i;
          for(i=0;i<5000;i++);
          }
          void init()
          {
          delay();
          DDRD=0XFF;


          PORTD|=BIT(3);
          PORTD&=~BIT(3);
          PORTD|=BIT(3);
          write_cmd(0x30,0);
          delay();
          write_cmd(0x30,0);
          delay();
          write_cmd(0x0C,1);
          delay();
          write_cmd(0x01,1);
          delay();
          delay();
          write_cmd(0X06,1);
          delay();
          write_cmd(0X0F,1);
          delay();
          // write_cmd(0X03,1);
          delay();
          //write_cmd(0X7A,1);
          delay();
          }

          本文引用地址:http://cafeforensic.com/article/201611/321656.htm

          void write_dat(uchar dat)
          {

          RDBZ();
          DDRA=0XFF;
          PORTD&=~BIT(5);
          PORTD|=BIT(6)|BIT(4);
          PORTA=dat;
          PORTD&=~BIT(6);

          }

          void main()
          {
          uchar j;
          init();

          {

          write_cmd(0x90,1);
          for(j=0;j<16;j++)
          {
          write_dat(string1[j]);
          }
          }
          while(1);
          }



          關(guān)鍵詞: atmega161286

          評(píng)論


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

          關(guān)閉