資源簡介
利用STM32F103和CS1238實現(xiàn)4~20mA電流采樣,使用芯海官方提供的驅(qū)動結(jié)合STM32的HAL庫設(shè)計,驗證可靠運行,MCU運行72M,兩線IO操作,使用掃描方式檢測,Cs1238使用外部2.5V基準電壓,pga=1
代碼片段和文件信息
#define?_C_ExtAD
#include?“AppDef.h“
#include?“ExtAD.h“
//輸出:dir?=?1??輸入:dir=0
void?AD_DAT_MODE(u16?dir)
{
??GPIO_InitTypeDef?GPIO_InitStruct?=?{0};
??switch(dir)
??{
??case?0:
????{
??????
???????GPIO_InitStruct.Pin?=?GPIO_PIN_7;
??????GPIO_InitStruct.Mode?=?GPIO_MODE_INPUT;
??????GPIO_InitStruct.Pull?=?GPIO_NOPULL;
??????HAL_GPIO_Init(GPIOA?&GPIO_InitStruct);
??????
??????/*
??????GPIO_InitStruct.Pin?=?GPIO_PIN_7;
??????GPIO_InitStruct.Mode?=?GPIO_MODE_IT_FALLING;
??????GPIO_InitStruct.Pull?=?GPIO_NOPULL;
??????HAL_GPIO_Init(GPIOA?&GPIO_InitStruct);
??????*/
????}
????break;
??case?1:
????{
??????GPIO_InitStruct.Pin?=?GPIO_PIN_7;
??????GPIO_InitStruct.Mode?=?GPIO_MODE_OUTPUT_PP;
??????GPIO_InitStruct.Pull?=?GPIO_NOPULL;
??????GPIO_InitStruct.Speed?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????7195??2020-01-25?19:01??ExtAD.c
?????文件????????1340??2020-01-25?18:45??ExtAD.h
評論
共有 條評論