-
大小: 4KB文件類型: .rar金幣: 2下載: 1 次發(fā)布日期: 2021-05-29
- 語(yǔ)言: 其他
- 標(biāo)簽: MAX44009??驅(qū)動(dòng)??源碼??STM32F4??
資源簡(jiǎn)介
MAX44009驅(qū)動(dòng)STM32F4源碼,包括IIC底層驅(qū)動(dòng),MAX44009數(shù)據(jù)采集與處理

代碼片段和文件信息
#include?“sys.h“
#include?“delay.h“
#include?“usart.h“
#include?“l(fā)ed.h“
#include?“MAX44009.h“
#include?“exti.h“
extern? u8?High_LuxLow_Lux;
int?main(void)
{?
u8?exponentmantissa;
float?result;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//設(shè)置系統(tǒng)中斷優(yōu)先級(jí)分組2
EXTIX_Init();???????//初始化外部中斷輸入?
??uart_init(115200);
delay_init(168); ??//初始化延時(shí)函數(shù)
LED_Init(); ????????//初始化LED端口
MAX44009_Init();//delay_ms(10);
??MAX44009_WriteOneByte(0x020x80);//連續(xù)轉(zhuǎn)換、手動(dòng)模式、積分時(shí)間6.25MS
// MAX44009_WriteOneByte(0x050x55);
// MAX44009_WriteOneByte(0x060x66);
// MAX44009_WriteOneByte(0x070x77);
//MAX44009_WriteOneByte(0x010x01);//使能max44009中斷
??while(1)
{
?????
//LED0=~LED0;
//Uart1_PutChar(0x55);
//Uart1_PutChar(MAX44009_ReadOneByte(0x00));
//Uart1_PutChar(MAX44009_ReadOneByte(0x01));
//MAX44009_WriteOneByte(0x020x80);
//Uart1_PutChar(MAX44009_ReadOneByte(0x02));
//Uart1_PutChar(MAX44009_ReadOneByte(0x03));
//Uart1_PutChar(MAX44009_ReadOneByte(0x04));
MAX44009_ReadLux(0x030x04);
//Uart1_PutChar(High_Lux);
//Uart1_PutChar(Low_Lux);
exponent?=?(High_Lux?&?0xF0)?>>?4;
mantissa?=?(High_Lux?&?0x0F)?<4;
mantissa?+=?Low_Lux?&?0x0F;
result?=?mantissa?*?(1?< printf(“\r\n光傳感測(cè)試值:?%f\n“result);
// Uart1_PutChar(MAX44009_ReadOneByte(0x05));
// Uart1_PutChar(MAX44009_ReadOneByte(0x06));
// Uart1_PutChar(MAX44009_ReadOneByte(0x07));
delay_ms(1000);
?}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????3835??2017-11-23?13:55??MAX44009.c
?????文件????????606??2017-11-14?16:30??MAX44009.h
?????文件???????1395??2017-11-23?10:48??myiic.h
?????文件???????1534??2017-11-23?15:09??main.c
?????文件???????3333??2017-11-23?14:21??myiic.c
-----------?---------??----------?-----??----
????????????????10703????????????????????5
評(píng)論
共有 條評(píng)論