MAX1233/MAX1234触摸屏控制器入门

[09-13 17:05:19]   来源:http://www.88dzw.com  控制技术   阅读:8648

文章摘要: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; m

MAX1233/MAX1234触摸屏控制器入门,标签:计算机控制技术,工厂电气控制技术,http://www.88dzw.com

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
0x0040 0x1f01

0x8006 0x0000

2.6) 将BAT1和BAT2转换结果译为物理值

下面的C/C++伪代码片断总结了DEMO1234程序是怎样解释BAT1和BAT2转换结果的。注意:通过一个4:1输入分配器来测量BAT1和BAT2。
    /* 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;

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]  下一页


Tag:控制技术计算机控制技术,工厂电气控制技术控制技术