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

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > Max7221數(shù)碼管動(dòng)態(tài)顯示

            Max7221數(shù)碼管動(dòng)態(tài)顯示

            作者: 時(shí)間:2016-11-17 來源:網(wǎng)絡(luò) 收藏
            C代碼:

            /**************************************************************************

            THE MAX7221 LED DRIVER LIB

            COPYRIGHT (c) 2005 BY JJJ.
            -- ALL RIGHTS RESERVED --

            File Name: Max7221.h
            Author: Jiang Jian Jun
            Created: 2005/9/19
            Modified:NO
            Revision: 1.0

            ***************************************************************************/
            #ifndef _MAX7221_LED_DRIVER_2005_9_19_
            #define _MAX7221_LED_DRIVER_2005_9_19_

            本文引用地址:http://www.biyoush.com/article/201611/315532.htm

            #include

            sbit Max7221CS = P3^1;
            sbit Max7221DIN = P3^0;
            sbit Max7221CLK = P3^2;

            void WriteMax7221(unsigned char Address,unsigned char Data)
            {
            unsigned char i;
            Max7221CS = 0;
            for (i=0;i<8;i++)
            {
            Max7221CLK = 0;
            Max7221DIN = (Address&(0x80>>i)) ? 1:0;
            _nop_();
            _nop_();
            Max7221CLK = 1;
            _nop_();
            _nop_();
            }
            for (i=0;i<8;i++)
            {
            Max7221CLK = 0;
            Max7221DIN = (Data&(0x80>>i)) ? 1:0;
            _nop_();
            _nop_();
            Max7221CLK = 1;
            _nop_();
            _nop_();
            }
            Max7221CS = 1;
            }

            void InitialMax7221(void)
            {
            WriteMax7221(0x0A,0x07);//亮度地址0AH,0x00~0x0F,0x0F最亮
            WriteMax7221(0x0B,0x07);//掃描LED個(gè)數(shù)地址0BH,0x00~0x07,最多掃描8個(gè)數(shù)碼管
            WriteMax7221(0x0C,0x01);//工作模式地址0x0C. 0x00:ShutDown;0x01:Normal
            WriteMax7221(0x09,0xFF);//編碼模式地址0x09. 0x00~0xFF:哪一位為1,哪一位就支持編碼
            }

            void Max7221Display(unsigned char *buffer)
            {
            unsigned char i;
            for(i=0;i<8;i++)
            {
            WriteMax7221(i+1,*(buffer+i));
            }
            }

            #endif

            #include
            #include "Max7221.h"

            unsigned char DisplayBuffer[8]={0,1,2,3,4,5,6,7};//顯示緩沖區(qū)

            main()
            {
            InitialMax7221();
            Max7221Display(&DisplayBuffer[0]);
            while(1);
            }
            仿真電路



            評(píng)論


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

            關(guān)閉