找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4023|回复: 2
收起左侧

基于合泰单片机模拟单总线收发数据程序

[复制链接]
ID:387723 发表于 2018-8-19 15:12 | 显示全部楼层 |阅读模式
分享个合泰单片机做的模拟单总线收发数据程序
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. }
复制代码

所有资料51hei提供下载:
模拟单总线收发源代码.rar (577.66 KB, 下载次数: 68)

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

回复

使用道具 举报

ID:437028 发表于 2018-12-1 11:53 | 显示全部楼层
不错的建议程序,希望可以能多多说以
回复

使用道具 举报

ID:867090 发表于 2020-12-24 14:47 | 显示全部楼层
感谢楼主分享,刚好用得上
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表