MAX1233/MAX1234触摸屏控制器入门

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

文章摘要:2.7) 测量内部温度TEMP1和TEMP2表8. ADC测量命令序列 DEMO1234 CommandAction (Triggered by A/D3210 Bits)SPI data inT MAMeasure TEMP1 with 12-bit resolution and 3.5µs conversion rate0x0040 0x2b010x8009 0x0000T W AC 2b01Trigger ADC scan of TEMP1;ADC control word 0x2b01 means:ADC_control_wr_demand_scanADC_control_

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

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;

2.9) 将TEMP1和TEMP2转换结果译为物理值

下面的C/C++伪代码片断总结了DEMO1234程序是怎样解释TEMP1和TEMP2转换结果的。TEMP2只在和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;
    
    /* TEMP2_code is the 16-bit result read by SPI command 0x800a */
    double TEMP2_Voltage = (TEMP2_code * ADC_fullscale_voltage) / num_codes;
    
    /* Calibration values */
    const double K_Per_Temp21_Delta_V = 2680.0; // nominal 2680 5/27/2002
    
    /* Convert to absolute temperature */
    double Kelvin = (TEMP2_Voltage - TEMP1_Voltage) * K_Per_Temp21_Delta_V;
    
    /* Optional conversion to commonly used temperature units */
    double Centigrade = Kelvin - 273.15;
    double Fahrenheit = (Centigrade * 9.0 / 5.0) + 32;

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


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