欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
STM8用模擬IIC讀寫DS1307源程序 實測有效
[打印本頁]
作者:
王杰
時間:
2019-8-6 09:02
標題:
STM8用模擬IIC讀寫DS1307源程序 實測有效
一起探討學習
單片機源程序如下:
#include "bsp.h"
#include "stdio.h"
#include "string.h"
#include "ds1307.h"
#include "soft_iic.h"
#define led_1() GPIO_WriteHigh(GPIOD, GPIO_PIN_0)
#define led_0() GPIO_WriteLow(GPIOD, GPIO_PIN_0)
u8 sendData[] = "iic_test";
u8 revData[10];
u8 DeviceData[10];
void main(void)
{
uint8_t rev_dat=0;
uint8_t i=0;
uint8_t t_data=0x11;
uint8_t t_data1=0x00;
uint8_t temp;
BSP_Initializes();
soft_IIC_init();
IIC_Init();
led_0();
timer_delay_s(1);
led_1();
//IIC_Write(0xD0 , 0x07 , &t_data , 1); //用片內IIC寫數據
//IIC_Write(0xD0 , 0x03 , &t_data1 , 1);
iic_write_ds1307(0xD0,0x07,0x13);//control SQ_pin ouuput square wave address 0x07
// 0x10 <--> 1Hz 0x11 <--> 4096Hz 0x12 <--> 8192Hz 0x13 <--> 32.768kHz
//iic_write_ds1307(0xD0,0x02,0xd);
rev_dat = iic_read_ds1307(0xD0,0x01); //read mimutes
while(1)
{
if(rev_dat==35)
{
led_0();
timer_delay_s(1);
led_1();
timer_delay_s(1);
}
}
}
#ifdef USE_FULL_ASSERT
void assert_failed(u8* file, u32 line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif
復制代碼
所有資料51hei提供下載:
GPIO_IIC -1.7z
(3.83 MB, 下載次數: 64)
2019-8-6 17:21 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
oppkxy
時間:
2020-3-7 21:37
垃圾,這個是硬件的
作者:
maoyongyi
時間:
2022-3-10 22:15
可以用
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1