找回密碼
         注冊(cè)會(huì)員
        搜索附件  

        tm1616.pdf

         

        TM1616程序源代碼附TM1616中文PDF與原理圖:
        TM1616程序源代碼附TM1616中文PDF與原理圖

        TM1616驅(qū)動(dòng)共陰數(shù)碼管接線電路圖

        T1616驅(qū)動(dòng)共陰數(shù)碼管源代碼
        TM1616.H
        1. #include <STC12C56.H>
        2. #include <intrins.h>
        3. #define clk P10                                        //定義時(shí)鐘管腳
        4. #define dio        P11                                        //定義數(shù)據(jù)管腳
        5. #define stb P37                                        //定義片選管腳
        6. #define nop _nop_();
        7. #define uchar unsigned char
        8. #define uint  unsigned int
        復(fù)制代碼
        TM1616.C
        1. #include <STC12C56.H>
        2. #include <intrins.h>
        3. #include <tm1616.h>
        4. //---------------------TM1616發(fā)送1字節(jié)數(shù)據(jù)子程序------------------------------------------
        5. void tm1616write(uchar wr_date)
        6. {
        7.         uchar i;
        8.         stb =0;
        9.         nop;
        10.         nop;
        11.         for(i=0;i<8;i++)
        12.         {
        13.                 clk=0;
        14.                 nop;
        15.                 nop;
        16.                 if(wr_date&0x01!=0)
        17.                 {
        18.                         dio=1;
        19.                 }
        20.                 else
        21.                 {
        22.                         dio=0;
        23.                 }
        24.                 nop;
        25.                 nop;
        26.                 clk=1;
        27.                 nop;
        28.                 wr_date=wr_date>>1;
        29.         }       
        30. }
        31. //-------------------------TM1616采用固定地址顯示數(shù)據(jù)子程序--------------------------------------------
        32. void tm1616show(uchar data1,uchar data2,uchar data3,uchar data4)
        33. {
        34.         uchar j;
        35.         stb = 1;
        36.         clk = 1;
        37.         dio = 1;
        38.         tm1616write(0x00);                          //顯示模式設(shè)置,設(shè)置為4個(gè)GRID,7個(gè)SEG
        39.         stb=1;                                                        //顯示模式設(shè)置完畢,STB置1
        40.         tm1616write(0x44);                          //數(shù)據(jù)命令設(shè)置,設(shè)置普通模式、固定地址、寫數(shù)據(jù)到顯示寄存器
        41.         stb=1;                                                        //數(shù)據(jù)命令設(shè)置完畢,STB置1
        42.         for(j=0;j<4;j++)                            //4位數(shù)碼管要發(fā)送4次數(shù)據(jù)
        43.         {
        44.                 tm1616write(0xC0);                        //設(shè)置顯示地址1
        45.                 tm1616write(data1);                 //傳輸顯示數(shù)據(jù)1
        46.                 stb=1;                                                //顯示數(shù)據(jù)1發(fā)送完畢STB置1
        47.                 tm1616write(0xC2);                        //設(shè)置顯示地址1
        48.                 tm1616write(data2);                 //傳輸顯示數(shù)據(jù)1
        49.                 stb=1;                                                //顯示數(shù)據(jù)1發(fā)送完畢STB置1
        50.                 tm1616write(0xC4);                        //設(shè)置顯示地址1
        51.                 tm1616write(data3);                 //傳輸顯示數(shù)據(jù)1
        52.                 stb=1;                                                //顯示數(shù)據(jù)1發(fā)送完畢STB置1
        53.                 tm1616write(0xC6);                        //設(shè)置顯示地址2
        54.                 tm1616write(data4);                 //傳輸顯示數(shù)據(jù)1
        55.                 stb=1;                                                //顯示數(shù)據(jù)1發(fā)送完畢STB置1
        56.         }
        57.         tm1616write(0x8F);                                //控制命令設(shè)置,設(shè)置顯示開、顯示最亮
        58.         stb=1;                                                        //顯示數(shù)據(jù)發(fā)送完畢STB置1
        59. }
        復(fù)制代碼
        TM1616主函數(shù)
        1. #include <STC12C56.H>
        2. #include <intrins.h>
        3. #include <tm1616.c>

        4. #define uchar unsigned char
        5. #define uint  unsigned int

        6. void ioinit(void)
        7. {
        8.         P0M0 = 0x00;
        9.         P0M1 = 0x00;
        10.         P1M0 = 0x00;
        11.         P1M1 = 0x00;
        12.         P2M0 = 0x00;
        13.         P2M1 = 0x00;
        14.         P3M0 = 0x00;
        15.         P3M1 = 0xE0;
        16. }

        17. void main(void)
        18. {
        19.         ioinit();
        20.         while(1)
        21.         {
        22.                 tm1616show(0x5B,0x66,0x4F,0xFF);                       
        23.         }

        24. }
        復(fù)制代碼
        TM1616中文PDF及原理圖源代碼下載




        本程序基于stc12c5628單片機(jī)  如KEIL中沒有STC頭文件請(qǐng)自行添加,添加教程可以在本論壇搜索
        幫忙頂一個(gè)。。。。。。。。。
        08.void ioinit(void)

        09.{

        10.        P0M0 = 0x00;

        11.        P0M1 = 0x00;

        12.        P1M0 = 0x00;

        13.        P1M1 = 0x00;

        14.        P2M0 = 0x00;

        15.        P2M1 = 0x00;

        16.        P3M0 = 0x00;

        17.        P3M1 = 0xE0;

        18.}
        請(qǐng)問 這個(gè) 初始化 是什么意思?希望  能回答下
        謝謝樓主提供的資料,解決很大問題
        disguise2012 發(fā)表于 2013-10-3 10:41
        **** 作者被禁止或刪除 內(nèi)容自動(dòng)屏蔽 ****

        這個(gè)是對(duì)端口進(jìn)行設(shè)置,根據(jù)需要可以設(shè)置成準(zhǔn)雙向,推挽輸出,輸入,開漏輸出,建議看一下STC的手冊(cè)

        QQ|手機(jī)版|MCU資訊論壇 ( 京ICP備18035221號(hào)-2 )|網(wǎng)站地圖

        GMT+8, 2025-3-16 21:36 , Processed in 0.025524 second(s), 8 queries , Redis On.

        Powered by Discuz! X3.5

        © 2001-2024 Discuz! Team.

        返回頂部
        国产精品污WWW在线观看| 亚洲精品欧美综合在线| 亚洲国产成人久久精品动漫 | 亚洲精品国产精品乱码不卡√| 久久ww精品w免费人成| 欧美日韩精品在线| 欧美 日韩 精品 另类视频| 日韩精品无码一本二本三本| 中文字幕精品视频| 综合色桃花久久亚洲| 国产精品高清一区二区三区 | 亚洲AⅤ永久无码精品AA| 久久99精品久久久久久动态图 | 中文字幕精品亚洲无线码二区| 91在线视频精品| 久久精品国产亚洲Aⅴ香蕉| 无码精品人妻一区二区三区中| 久久精品国产91久久综合麻豆自制| 久久精品国产第一区二区| 日韩精品无码专区免费播放| 亚洲综合一区二区精品导航| 影音先锋最新资源网| 久久这里只有精品首页| 午夜在线视频91精品| 91精品国产乱码久久久久久| 精品人妻无码专区中文字幕| 色欲国产麻豆一精品一AV一免费| 国产AV国片精品一区二区| 福利体验试看120秒| 香蕉国产精品频视| 国产精品区牛牛影院| 成人精品一区二区三区在线观看 | 欧美精品免费线视频观看视频| 亚洲精品亚洲人成在线观看下载 | 欧美日韩精品在线观看| 国产精品无码无卡在线播放| 久久精品成人影院| 国产精品电影在线观看| 亚洲日韩中文在线精品第一 | 日韩午夜高清福利片在线观看欧美亚洲精品suv | 国产精品视频一区二区噜噜|