資源簡介
MAX44009驅動STM32F4源碼,包括IIC底層驅動,MAX44009數據采集與處理

代碼片段和文件信息
#include?“sys.h“
#include?“delay.h“
#include?“usart.h“
#include?“led.h“
#include?“MAX44009.h“
#include?“exti.h“
extern? u8?High_LuxLow_Lux;
int?main(void)
{?
u8?exponentmantissa;
float?result;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//設置系統中斷優先級分組2
EXTIX_Init();???????//初始化外部中斷輸入?
??uart_init(115200);
delay_init(168); ??//初始化延時函數
LED_Init(); ????????//初始化LED端口
MAX44009_Init();//delay_ms(10);
??MAX44009_WriteOneByte(0x020x80);//連續轉換、手動模式、積分時間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光傳感測試值:?%f\n“result);
// Uart1_PutChar(MAX44009_ReadOneByte(0x05));
// Uart1_PutChar(MAX44009_ReadOneByte(0x06));
// Uart1_PutChar(MAX44009_ReadOneByte(0x07));
delay_ms(1000);
?}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????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
- 上一篇:黃金外匯原油20年一分鐘走勢數據,需要的進來
- 下一篇:易語言Winsocket模塊
評論
共有 條評論