找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 5027|回復(fù): 2
收起左側(cè)

基于合泰單片機模擬單總線收發(fā)數(shù)據(jù)程序

[復(fù)制鏈接]
ID:387723 發(fā)表于 2018-8-19 15:12 | 顯示全部樓層 |閱讀模式
分享個合泰單片機做的模擬單總線收發(fā)數(shù)據(jù)程序
0.png

單片機源程序如下:
  1. /******************************************************************************
  2. ;   This file is a basic template for assembly code for a HT66FXXX. Copy      *
  3. ;   this file into your project directory and modify or add to it as needed.  *
  4. ;                                                                             *
  5. ;   The HT66FXXX architecture allows two interrupt configurations. This       *
  6. ;   template code is written for priority interrupt levels and the IPEN bit   *
  7. ;   in the RCON register must be set to enable priority levels. If IPEN is    *
  8. ;   left in its default zero state, only the interrupt vector at 0x008 will   *
  9. ;   be used and the WREG_TEMP, BSR_TEMP and STATUS_TEMP variables will not    *
  10. ;   be needed.                                                                *
  11. ;                                                                             *
  12. ;   Refer to the HI-IDE3000 User's Guide for additional information on the    *
  13. ;   features of the assembler.                                                *
  14. ;                                                                             *
  15. ;   Refer to the HT66F002 Data Sheet for additional                           *
  16. ;   information on the architecture and instruction set.                      *
  17. ;                                                                             *
  18. ;******************************************************************************
  19. ;    Filename:*******                                                         *
  20. ;    creation time:2018.01.10                                                 *
  21. ;    modification time:                                                       *                        
  22. ;    Author: *********                                                        *
  23. ;                                                                             *
  24. ;******************************************************************************                                   
  25. ;    Files required: HT66F002.INC                                             *  
  26. ;******************************************************************************
  27. ;   notes:
  28. ;*******************************************************************************
  29. ;
  30. ;   Revision History:
  31. ;
  32. ;******************************************************************************
  33. ;        list p=HT66F002;directive to define processor
  34. ;******************************************************************************
  35. ;Configuration bits
  36. ;HOLTEK has changed the format for defining the configuration bits, please
  37. ;see the .inc file for futher details on notation.  Below are a few examples.
  38. ;******************************************************************************/
  39. #define  _HT_66F003_

  40. #ifdef   _HT_66F003_

  41. //#include <HT50F51.h>
  42. #include <HT66F003.h>
  43. #endif

  44. #include "initial.h"
  45. #include "Define.h"
  46. #include "function.h"
  47. #include "switch.h"
  48. #define  _MAIN_
  49. #include "variable.h"
  50. #undef   _MAIN_
  51. //list p=HT50F51;
  52. #pragma rambank0

  53. extern         uchar8    rError_Temp;

  54. #pragma  norambank

  55. void main()
  56. {
  57.     pInit_Port_IO() ;
  58.     ENABLE_ALL_INT_EA() ;
  59.     Usb_Lianjie_OK_F = 0 ;
  60.     while(!F_4S)      // 上電所有燈亮4s,進入主程序
  61.     {
  62.        _clrwdt() ;
  63.        if(F_1MS)
  64.        {
  65.                  F_1MS = 0 ;
  66.                  pTimerAccoutDeal();
  67.                  PTest_Usb_Signal();
  68.        }
  69.        if(F_10MS)
  70.        {
  71.                  F_10MS = 0 ;
  72.                  LED_ALL_ON();
  73.                  Key_Process();
  74.        }               
  75.     }
  76. //    F_Send_Data_Enable = 1 ;
  77.     LED_ALL_OFF();
  78.     PTM1_START() ;
  79. //    Usb_Lianjie_OK_F = 1 ;  
  80.     if(!Usb_Lianjie_OK_F)
  81.     {
  82.        USB_IO_Output_Mode() ;
  83.     }
  84. //***********************main program***********************************************************   
  85.    while(1)       
  86.    {
  87.       _clrwdt() ;
  88.       if(F_1MS)
  89.       {
  90.                 F_1MS = 0 ;
  91.                 pTimerAccoutDeal();
  92.       }
  93.       if(F_10MS)
  94.       {
  95.           F_10MS = 0 ;
  96.           if(!Usb_Lianjie_OK_F)
  97.           {
  98.               pLed_Indicator_Deal();
  99.           }
  100.           Key_Process ();
  101.       }         
  102.    }   
  103. }
復(fù)制代碼

所有資料51hei提供下載:
模擬單總線收發(fā)源代碼.rar (577.66 KB, 下載次數(shù): 71)



評分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

回復(fù)

使用道具 舉報

ID:437028 發(fā)表于 2018-12-1 11:53 | 顯示全部樓層
不錯的建議程序,希望可以能多多說以
回復(fù)

使用道具 舉報

ID:867090 發(fā)表于 2020-12-24 14:47 | 顯示全部樓層
感謝樓主分享,剛好用得上
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表