数字电位器mcp4018怎么编程
发布网友
发布时间:2022-04-20 19:48
我来回答
共2个回答
热心网友
时间:2023-07-01 03:08
Microchip 公司的MCP4017/18/19是通用的数字电位器,具有7位电阻网络分辨率,有127个电阻,具有低的温度系数:绝对值(0-70度C)为50ppm,比值为10ppm,工作电压1.8V到5.5V. MCP4017/18/19可应用在设定电或失调调整,传感器校准,替代机械式电位计和可选择增益和失调放大器设计.本文介绍了MCP4017/18/19的主要特性, 方框图, 和微控制器(MCU) 典型连接框图, 采用MCP4017调整非反相放大器失调和增益方框图以及采用MCP4018的可编滤波器和采用MCP4017的惠斯通电桥调整框图.
The MCP4017/18/19 devices are general purpose digital potentiometers intended to be used in applications where a programmable resistance with moderate bandwidth is desired.
This Data Sheet covers a family of three Digital Potentiometer and Rheostat devices. The MCP4018 device is the Potentiometer configuration, while the MCP4017 and MCP4019 devices are the Rheostat configuration.
MCP4017/18/19主要特性:
Potentiometer or Rheostat configuration options
7-bit: Resistor Network Resolution
127 Resistors (128 Steps)
Zero Scale to Full Scale Wiper operation
RAB Resistances: 5 kΩ, 10 kΩ, 50 kΩ, or 100 kΩ
Low Wiper Resistance: 100Ω (typical)
Low Tempco:
Absolute (Rheostat): 50 ppm typical (0℃ to 70℃)
Ratiometric (Potentiometer): 10 ppm typical
Simple I2C Protocol with read & write commands
Brown-out reset protection (1.5V typical)
Power-on Default Wiper Setting (Mid-scale)
Low-Power Operation:
2.5 μA Static Current (typical)
Wide Operating Voltage Range:
2.7V to 5.5V - Device Characteristics Specified
1.8V to 5.5V - Device Operation
MCP4017/18/19应用:
Applications generally suited for the MCP401X devices include:
Set point or offset trimming
Sensor calibration
Selectable gain and offset amplifier designs
Cost-sensitive mechanical trim pot replacement
热心网友
时间:2023-07-01 03:08
数字电位器用的是
mcp4018
#include<reg51.h>
#include<stdio.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
//设定四个按键
sbit X9C102=P2^0;
sbit X9C202=P2^1;
sbit X9C302=P2^2;
sbit X9C402=P2^3;
sbit X9C103_CS=P1^0;
sbit X9C103_INC=P1^1;
sbit X9C103_UD=P1^2;
void delay_nus(uint i)
{
while(i--);
}
void delay_nms(uchar i)
{
for(i;i>0;i++)
{
delay_nus(1000);
}
}
void set_x9c103(uchar num,uchar ud,uchar save)
{
X9C103_CS=0;
delay_nus(1);
if(ud==1)
{
X9C103_UD=1;
}
else
{
X9C103_UD=0;
}
delay_nus(4);
for(num;num>0;num--)
{
X9C103_INC=1;
delay_nus(2);
X9C103_INC=0;
delay_nus(2);
}
delay_nus(2);
if(save==1)
{
X9C103_INC=1;
delay_nus(2);
X9C103_CS=1;
delay_nms(22);
}
X9C103_CS=1;
delay_nus(10);
}
void clear_down()
{
set_x9c103(100,0,1);
}
void main_init()
{
X9C103_CS=0;
clear_down();
}
void main()
{
main_init();
set_x9c103(70,1,1);
while(1)//扫描按键,对应不同倍数的输出
{
if (X9C102==0){
clear_down();
set_x9c103(10,1,1);}
if (X9C202==0){
clear_down();
set_x9c103(30,1,1);}
if (X9C302==0){
clear_down();
set_x9c103(60,1,1);}
if (X9C402==0){
clear_down();
set_x9c103(90,1,1);}
}
}