找回密码
 立即注册

QQ登录

只需一步,快速开始

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

STM8模拟IIC 读写模拟寄存器

[复制链接]
ID:125378 发表于 2019-8-16 09:16 | 显示全部楼层 |阅读模式
  1. /**
  2.   ******************************************************************************
  3.   * @file    main.c
  4.   * @author  Wang
  5.   * @version V1.0.0
  6.   * @date    6-August-2019
  7.   * @brief   This file  call to function in other files
  8.   ********************************************************************************
  9. */

  10. /* Includes ------------------------------------------------------------------*/
  11. #include "include.h"
  12. #include "stdlib.h"

  13. /* Global variable declare *****************************************************/
  14. u8 DeviceData[10] ;   
  15. /**
  16.   * @brief  main entry point
  17.   * @param  None
  18.   * @retval None
  19. */
  20. void main(void)
  21. {
  22.   soft_reg BPR;
  23.        
  24.   uint8_t rdata;
  25.   BSP_Initializes();
  26.   soft_IIC_init();

  27.   Register_Init(&BPR);
  28.   Soft_Write_Register(&BPR);   
  29.         Timer1_Delay_1ms(10);
  30.         rdata = Soft_Read_Register(&BPR);
  31.        
  32.   while(1)
  33.   {
  34.                 if(rdata == 0x85)
  35.                 {
  36.                         LED_On();
  37.                         Timer1_Delay_1ms(200);
  38.                         LED_Off();
  39.                         Timer1_Delay_1ms(300);
  40.                 }
  41.   }
  42. }


  43. /**************************************END OF FILE**************************************/
复制代码


soft IIC read write register.7z

3.81 MB, 下载次数: 7, 下载积分: 黑币 -5

回复

使用道具 举报

ID:1 发表于 2019-8-16 21:29 | 显示全部楼层
本帖需要重新编辑补全电路原理图,源码,详细说明与图片即可获得100+黑币(帖子下方有编辑按钮)
回复

使用道具 举报

ID:282095 发表于 2019-8-17 00:38 | 显示全部楼层
个人感觉资料不全哦
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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