『壹』 數字電位器mcp4018怎麼編程
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
『貳』 怎麼用單片機控制數字電位器啊拜託大家,最好有程序啊,盡量是自己編寫的
數字電位器我用的是X9C103,接4個按鍵,每個按鍵輸出不同的電阻值,程序如下,請參考
#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);}
}
}