Internal 1V reference always powered; write ADC control word with
ADC3210 = 0000,
RES10 = 01,
RFV = 0
0x0040 0x0100
Voltage at pin 12 REF is between 0.98V and 1.02V
T W AC 0101
Internal 2.5V reference always powered; write ADC control word with
ADC3210 = 0000,
RES10 = 01,
RFV = 1
0x0040 0x0101
Voltage at pin 12 REF is between 2.47V and 2.53V
T W AC 0001
Internal 2.5V reference powered when needed; write ADC control word with
ADC3210 = 0000,
RES10 = 00,
RFV = 1
0x0040 0x0001
Voltage at pin 12 REF will be powered only briefly as necessary
表5. 外部基准命令
DEMO1234 Command
Action
SPI data in
T W AC 0300
External reference must be provided;
ADC_control_wr_demand_scan:(write)demand scan
ADC_control_AD0000:configure reference
ADC_control_RES11:external reference
0x0040 0x0300
2.3) 测量外部电压输入AUX1和AUX2
表6. ADC测量命令序列
DEMO1234 Command
Action (Triggered by A/D3210 Bits)
SPI data in
T M8
Measure AUX1 with 12-bit resolution and 3.5µs conversion rate
0x0040 0x2301
0x8007 0x0000
T W AC 2301
Trigger ADC scan of AUX1;
ADC control word 0x2301 means:
ADC_control_wr_demand_scan
ADC_control_AD1000 /* measure AUX1 */
ADC_control_RES11 /* 12-bit resolution */
ADC_control_AVG00 /* no averaging */
ADC_control_CNR00 /* conversion rate 3.5µs */
ADC_control_RFV /* RFV=1: VREF=2.5V */
0x0040 0x2301
T R A1
Read AUX1 result AUX1_code
0x8007 0x0000
T M9
Measure AUX2 with 12-bit resolution and 3.5µs conversion rate
0x0040 0x2701
0x8008 0x0000
2.4) 将AUX1和AUX2转换结果译为物理值
下面的C/C++伪代码片断总结了DEMO1234程序是怎样解释AUX1和AUX2转换结果的。
/* ADC control resolution value selects num_codes 4096 (12-bit), 1024 (10-bit), or 256 (8-bit) */
int num_codes = 4096; /* ADC_control_RES11: 12-bit resolution */
/* Voltage that corresponds to the full-scale ADC code; may be internal 1V or 2.5V ref, or ext ref. */
double ADC_fullscale_voltage = 2.5; /* ADC_control_RFV=1: VREF=2.5V. RFV=0: VREF=1.0V. */
/* AUX1_code is the 16-bit result read by SPI command 0x8007 */
double AUX1_Voltage = (AUX1_code * ADC_fullscale_voltage) / num_codes;
/* AUX2_code is the 16-bit result read by SPI command 0x8008 */
double AUX2_Voltage = (AUX2_code * ADC_fullscale_voltage) / num_codes;
2.5) 测量外部电压输入BAT1和BAT2
表7. ADC测量命令序列
DEMO1234 Command
Action (Triggered by A/D3210 Bits)
SPI data in
T M6
Measure BAT1 with 12-bit resolution and 3.5µs conversion rate
0x0040 0x1b01
0x8005 0x0000
T W AC 1b01
Trigger ADC scan of BAT1;
ADC control word 0x1b01 means:
ADC_control_wr_demand_scan
ADC_control_AD0110 /* measure BAT1 */
ADC_control_RES11 /* 12-bit resolution */
ADC_control_AVG00 /* no averaging */
ADC_control_CNR00 /* conversion rate 3.5µs */
ADC_control_RFV /* RFV=1: VREF=2.5V */
0x0040 0x1b01
T R B1
Read BAT1 result BAT1_code
0x8005 0x0000
T W AC 1b21
Trigger ADC scan of BAT1;
ADC control word 0x1b21 means:
ADC_control_wr_demand_scan
ADC_control_AD0110 /* measure BAT1 */
ADC_control_RES11 /* 12-bit resolution */
ADC_control_AVG00 /* no averaging */
ADC_control_CNR10 /* conversion rate 10µs */
ADC_control_RFV /* RFV=1: VREF=2.5V */
0x0040 0x1b21
T R B1
Read BAT1 result BAT1_code
0x8005 0x0000
T M7
Measure BAT2 with 12-bit resolution and 3.5µs conversion rate
/* ADC control resolution value selects num_codes 4096 (12-bit), 1024 (10-bit), or 256 (8-bit) */
int num_codes = 4096; /* ADC_control_RES11: 12-bit resolution */
/* Voltage that corresponds to the full-scale ADC code; may be internal 1V or 2.5V ref, or ext ref. */
double ADC_fullscale_voltage = 2.5; /* ADC_control_RFV=1: VREF=2.5V. RFV=0: VREF=1.0V. */
/* Note: BAT1 and BAT2 measure through a 4:1 input divider. */
/* BAT1_code is the 16-bit result read by SPI command 0x8005 */
double BAT1_Voltage = 4 * (BAT1_code * ADC_fullscale_voltage) / num_codes;
/* BAT2_code is the 16-bit result read by SPI command 0x8006 */
double BAT2_Voltage = 4 * (BAT2_code * ADC_fullscale_voltage) / num_codes;
2.7) 测量内部温度TEMP1和TEMP2
表8. ADC测量命令序列
DEMO1234 Command
Action (Triggered by A/D3210 Bits)
SPI data in
T MA
Measure TEMP1 with 12-bit resolution and 3.5µs conversion rate
0x0040 0x2b01
0x8009 0x0000
T W AC 2b01
Trigger ADC scan of TEMP1;
ADC control word 0x2b01 means:
ADC_control_wr_demand_scan
ADC_control_ AD1010 /* measure TEMP1 */
ADC_control_RES11 /* 12-bit resolution */
ADC_control_AVG00 /* no averaging */
ADC_control_CNR00 /* conversion rate 3.5µs */
ADC_control_RFV /* RFV=1: VREF=2.5V */
0x0040 0x2b01
T R T1
Read TEMP1 result TEMP1 _code
0x8009 0x0000
T MC
Measure TEMP1, TEMP2 with 12-bit resolution and 3.5µs conversion rate
0x0040 0x3301
0x8009 0x0000
0x800a 0x0000
T W AC 3301
Trigger ADC scan of TEMP1 and TEMP2;
ADC control word 0x3301 means:
ADC_control_wr_demand_scan
ADC_control_ AD1100 /* measure TEMP1,TEMP2 */
ADC_control_RES11 /* 12-bit resolution */
ADC_control_AVG00 /* no averaging */
ADC_control_CNR00 /* conversion rate 3.5µs */
ADC_control_RFV /* RFV=1: VREF=2.5V */
0x0040 0x3301
T R T1
Read TEMP1 result TEMP1 _code
0x8009 0x0000
T R T2
Read TEMP2 result TEMP2 _code
0x800a 0x0000
2.8) 将TEMP1转换结果译为物理值
下面的C/C++伪代码片断总结了DEMO1234程序是怎样解释TEMP1转换结果的。
/* ADC control resolution value selects num_codes 4096 (12-bit), 1024 (10-bit), or 256 (8-bit) */
int num_codes = 4096; /* ADC_control_RES11: 12-bit resolution */
/* Voltage that corresponds to the full-scale ADC code; may be internal 1V or 2.5V ref, or ext ref. */
double ADC_fullscale_voltage = 2.5; /* ADC_control_RFV=1: VREF=2.5V. RFV=0: VREF=1.0V. */
/* TEMP1_code is the 16-bit result read by SPI command 0x8009 */
double TEMP1_Voltage = (TEMP1_code * ADC_fullscale_voltage) / num_codes;
/* Calibration values */
const double Temp1V_Room = 0.590; // temp1 voltage at room temperature 25C
const double Temp1K_Room = 298.15; // Room temperature Kelvins (298.15K=25C)
const double Temp1V_Per_K = -0.002; // TempCo -2mV per degree C
/* Convert to absolute temperature */
double Kelvin = (TEMP1_Voltage - Temp1V_Room) / Temp1V_Per_K + Temp1K_Room;
/* Optional conversion to commonly used temperature units */
double Centigrade = Kelvin - 273.15;
double Fahrenheit = (Centigrade * 9.0 / 5.0) + 32;
Swap the X+ and X- connections, and swap the Y+ and Y- connections
Touch coordinates are mirrored diagonally
Swap the X+ and Y+ connections, and swap the X- and Y- connections
Touch coordinates do not seem to track, and the distortion is not a simple flip/rotate/mirror transformation
Swap the X+ and Y+ connections; if distortion persists, swap the X+ and Y- connections; if distortion still persists, disconnect touch screen and use DVM to verify X+ to X- resistance and Y+ to Y- resistance; verify with no touch X+ and X- are isolated from Y+ and Y-
Keypad: (C4,C3,C2,C1) x (R4,R3,R2,R1); GPIO outputs: none; GPIO inputs: none
0x004f 0x0000
T W KC bf00
Wait for keypress; maximum debounce and hold times
0x0041 0xbf00
T W KM 0020
Mask only R2C2 key
0x0050 0x0020
Press and release R1C1 (key "1")
T R KB
Read raw keypad result
0x8004 0x0000
0x0001 = R1C1 key
T R K2
Read masked keypad result
0x8011 0x0000
0x0001 = R1C1 key
Press and release R2C2 (key "5")
T R KB
Read raw keypad result
0x8004 0x0000
0x0020 = R2C2 key
T R K2
Read masked keypad result
0x8011 0x0000
0x0000 = no key
Press and release R3C2 (key "8")
T R KB
Read raw keypad result
0x8004 0x0000
0x0040 = R3C2 key
T R K2
Read masked keypad result
0x8011 0x0000
0x0040 = R3C2 key
4.5) 从键盘中屏蔽一列
使用键盘列寄存器来屏蔽所有列。不扫描屏蔽列,因此,KPD寄存器不会探测这些列中的按键。
表18. 按键命令序列:屏蔽键盘的一列
DEMO1234 Command
Action
SPI data in
Verification
T W GC 0000
Keypad: (C4,C3,C2,C1) x (R4,R3,R2,R1); GPIO outputs: none; GPIO inputs: none
0x004f 0x0000
T W KC bf00
Wait for keypress; maximum debounce and hold times
0x0041 0xbf00
T W KK 2000
Mask entire C2 column
0x0051 0x2000
Press and release R1C1 (key "1")
T R KB
Read raw keypad result
0x8004 0x0000
0x0001 = R1C1 key
Press and release R2C2 (key "5")
T R KB
Read raw keypad result
0x8004 0x0000
(previous value)
Press and release R3C2 (key "8")
T R KB
Read raw keypad result
0x8004 0x0000
(previous value)
Press and release R2C3 (key "6")
T R KB
Read raw keypad result
0x8004 0x0000
0x0200 = R2C3 key
5) 电源管理
表19. 关断命令
DEMO1234 Command
Action
SPI data in
Verification
T W AC C000
Power off ADC
0x0040 0xc000
—
T W AC 0300
Power off internal reference
0x0040 0x0300
REF = not driven
T W DC 8000
Disable DAC
0x0042 0x8000
DACOUT = 0.0V
T W KC C000
Power off keypad
0x0041 0xc000
—
6) 菜单系统
全部源代码实现下面的控制台菜单系统,它连接至MINIQUSB+模块。
CmodComm测试程序主菜单—在连接前
A) adjust timing parameters
L) CmodLog... functions
C) connect
D) Debug Messages
X) exit
对C (连接)命令的响应
C
Hardware supports optimized native SMBus commands.
Board connected.
Got board banner: Maxim MINIQUSB V01.05.41 >
Firmware version is OK.
(configured for SPI auto-CS 4-byte mode) (SCLK=2MHz) ...
主菜单—连接后有效
T) Test the device
8) CmodP8Bus... functions
A) adjust timing parameters
L) CmodLog... functions
P) CmodPin... functions
S) CmodSpi... functions
M) CmodSMBus... functions
$) CmodCommStringWrite list of hex codes
R) CmodBoardReset
D) Disconnect
测试菜单命令—连接后有效
R) Read register
W) Write register
M0) measure no measurement; configure reference
M1) measure X,Y
M2) measure X,Y,Z1,Z2
M3) measure X
M4) measure Y
M5) measure Z1,Z2
M6) measure BAT1/4
M7) measure BAT2/4
M8) measure AUX1
M9) measure AUX2
MA) measure TEMP1
MB) measure BAT1/4,BAT2/4,AUX1,AUX2,TEMP1,TEMP2
MC) measure TEMP1,TEMP2
MD) no measurement; drive Y+,Y-
ME) no measurement; drive X+,X-
MF) no measurement; drive Y+,X-
.) Exit this menu