<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 基于stc單片機(jī)的AT89S52離線燒錄器程序

          基于stc單片機(jī)的AT89S52離線燒錄器程序

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


          下面是部分源碼預(yù)覽,完整的代碼請到http://www.51hei.com/bbs/dpj-20605-1.html下載
          #include "uart.h"
          #include "s51pro.h"
          #include "myfun.h"

          本文引用地址:http://www.ex-cimer.com/article/201611/323824.htm

          #include "znfat/znFAT.h"

          extern unsigned char OutBuf[4];
          extern unsigned char InBuf[4];

          unsigned char idata psignbuf[3];

          unsigned char code_buf[32];

          sfr P1M0 = 0x92;
          sfr P1M1 = 0x91; //定義STC12單片機(jī)IO模式特殊功能寄存器

          struct znFAT_Init_Args idata Init_Args; //初始化參數(shù)集合
          struct FileInfo idata fileinfo; //文件信息集合

          void main()
          {
          unsigned int idata addr=0,i=0;
          unsigned int idata res=0,n_file=0,len=0;

          P1M1=0x40;//P16高阻輸入
          P1M0=0xa0; //如果使用51單片機(jī)來調(diào)試SD卡模塊,打開推挽,增強(qiáng)IO驅(qū)動能力

          UART_Init();
          UART_Send_Str("串口設(shè)置完畢");

          znFAT_Device_Init(); //存儲設(shè)備初始化
          UART_Send_Str("SD卡初始化完畢");

          znFAT_Select_Device(0,&Init_Args); //選擇設(shè)備

          res=znFAT_Init(); //文件系統(tǒng)初始化

          if(!res) //文件系統(tǒng)初始化成功
          {
          UART_Send_Str("Suc. to init FS");

          UART_Put_Inf("BPB_Sector_No:",Init_Args.BPB_Sector_No);
          UART_Put_Inf("Total_SizeKB:",Init_Args.Total_SizeKB);
          UART_Put_Inf("BytesPerSector:",Init_Args.BytesPerSector);
          UART_Put_Inf("FATsectors:",Init_Args.FATsectors);
          UART_Put_Inf("SectorsPerClust:",Init_Args.SectorsPerClust);
          UART_Put_Inf("FirstFATSector:",Init_Args.FirstFATSector);
          UART_Put_Inf("FirstDirSector:",Init_Args.FirstDirSector);
          UART_Put_Inf("FSsec:",Init_Args.FSINFO_Sec);
          UART_Put_Inf("Next_Free_Cluster:",Init_Args.Next_Free_Cluster);
          UART_Put_Inf("FreenCluster:",Init_Args.Free_nCluster);
          }
          else //文件系統(tǒng)初始化失敗
          {
          UART_Put_Inf("Fail to init FS , Err Code:",res);
          }
          //==================================================================

          res=znFAT_Open_File(&fileinfo,"/*.bin",n_file,1); //打開文件

          while(!res)
          {
          UART_Put_Inf("Suc. toopenfile ",n_file);
          UART_Send_Str("================================");
          UART_Send_Str("File_Name(Short 8.3):");
          UART_Send_Str(fileinfo.File_Name);UART_Send_Enter();
          if(fileinfo.have_lfn) //如果有長名,則輸出長名
          {
          UART_Send_Str("File_Name(Long Name):");
          //中文輸出其UNICODE編碼碼值
          i=0;
          while(fileinfo.longname[i])
          {
          if(fileinfo.longname[i]<0x80)
          UART_Send_Byte((unsigned char)fileinfo.longname[i++]);
          else
          {
          UART_Put_Hex(fileinfo.longname[i++]);
          UART_Send_Byte( );
          }
          }
          UART_Send_Enter();
          }
          else
          {
          UART_Send_Str("This file have not Long Name.");;
          }
          UART_Put_Inf("File_Size:",fileinfo.File_Size);


          上一頁 1 2 下一頁

          評論


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

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();