⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ad421.h

📁 msp430x44x系列单片机对A/D421的操作
💻 H
字号:
#ifndef __ad421_h__
#define __ad421_h__

#define ILOOP_SEL       P1SEL
#define ILOOP_DIR       P1DIR
#define ILOOP_OUT       P1OUT
#define ILOOP_IN        P1IN


#define ILOOP_LATCH     BIT6 					 
#define ILOOP_CLOCK     BIT5	                  
#define ILOOP_DATA      BIT7	                  

//4~20mA Latch pin definition
#define LATCH_IN        (ILOOP_DIR &= ~ILOOP_LATCH)       // set Latch as input
#define LATCH_OUT       (ILOOP_DIR |=  ILOOP_LATCH)	  // set Latch as output
#define READ_LATCH      (ILOOP_IN  &   ILOOP_LATCH)	  // read from latch pin
#define SET_LATCH	(ILOOP_OUT |=  ILOOP_LATCH)	  // set Latch pin
#define CLR_LATCH	(ILOOP_OUT &= ~ILOOP_LATCH)       // clear Latch pin

//4~20mA Clock pin definition
#define CLOCK_IN        (ILOOP_DIR &= ~ILOOP_CLOCK)       // set clcok as input
#define CLOCK_OUT       (ILOOP_DIR |=  ILOOP_CLOCK)	  // set clcok as output
#define READ_CLOCK      (ILOOP_IN  &   ILOOP_CLOCK)	  // read from clcok pin
#define SET_CLOCK	(ILOOP_OUT |=  ILOOP_CLOCK)	  // set clcok pin
#define CLR_CLOCK	(ILOOP_OUT &= ~ILOOP_CLOCK)       // clear clcok pin

//4~20mA Data pin definition
#define DATA_IN        (ILOOP_DIR &= ~ILOOP_DATA)         // set data as input
#define DATA_OUT       (ILOOP_DIR |=  ILOOP_DATA)	  // set data as output
#define READ_DATA      (ILOOP_IN  &   ILOOP_DATA)	  // read from data pin
#define SET_DATA       (ILOOP_OUT |=  ILOOP_DATA)	  // set data pin
#define CLR_DATA       (ILOOP_OUT &= ~ILOOP_DATA)         // clear data pin

void AD421Init(void);
void WriteAD421(unsigned int data);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -