新聞中心

        EEPW首頁 > 模擬技術 > 設計應用 > MAX1233/MAX1234觸摸屏控制器入門

        MAX1233/MAX1234觸摸屏控制器入門

        作者: 時間:2012-03-17 來源:網絡 收藏
        1100 /* 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 25Cconst 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;

        2.10) 測量外部電壓輸入AUX1、AUX2、BAT1、BAT2和溫度

        表9. ADC測量命令序列
        DEMO1234 Command
        Action (Triggered by A/D3210 Bits)
        SPI data in
        T MB
        Measure BAT1/4, BAT2/4, AUX1, AUX2, TEMP1, TEMP2 with 12-bit resolution and 3.5μs conversion rate
        0x0040 0x2f01

        0x8005 0x0000

        0x8006 0x0000

        0x8007 0x0000

        0x8008 0x0000

        0x8009 0x0000

        0x800a 0x0000
        T W AC 2f01
        Trigger ADC scan of BAT1-2, AUX1-2, TEMP1-2;
        ADC control word 0x2f01 means:
        ADC_control_wr_demand_scan
        ADC_control_ AD1011 /* measure AUX1 etc. */
        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 0x2f01
        T R B1
        Read BAT1 result BAT1 _code
        0x8005 0x0000
        T R B2
        Read BAT2 result BAT2_code
        0x8006 0x0000
        T R A1
        Read AUX1 result AUX1 _code
        0x8007 0x0000
        T R A2
        Read AUX2 result AUX2 _code
        0x8008 0x0000
        T R T1
        Read TEMP1 result TEMP1 _code
        0x8009 0x0000
        T R T2
        Read TEMP2 result TEMP2 _code
        0x800a 0x0000

        3) 實例

        下面的例子解釋了怎樣使用DEMO1234.EXE程序來獲得數據。

        3.1) 低成本商用

        在互聯網上搜索"PDA Digitizer/Glasstop",尋找合適的替代觸摸屏。高清觸摸屏玻璃的價格范圍在50美元至10美元之間,價格取決于型號以及玻璃是否全部貼在顯示屏上。

        3.2) 連接觸摸屏和評估板

        評估板提供突出插頭H5/H6來連接10mm柔性電纜或者長度更短的電纜。H6連接器的間距是0.5mm,比實際觸摸屏柔性電纜間距更精細。把柔性電纜插入H6,上鎖,選擇位于四條柔性電纜中每一電纜中心位置的H5引腳。跳接器連接H5和標有U1的X+、Y+、X-以及Y-測試點。

        3.3) 檢驗觸摸屏的連接

        第一次連接觸摸屏時,通過下面的步驟來驗證X和Y連接是否正確??梢杂袔讉€觸摸屏交叉連接,但大部分不會正常工作。在這些例子中,我們假設X- = left,X+ = right,Y- = top,Y+ = bottom。

        表10. 觸摸屏物理連接驗證命令序列
        DEMO1234 Command
        Action
        SPI data in
        Verification
        Connect DVM to X+/GND
        T MD
        No measurement; drive Y+,Y-
        0x0040 0x3701
        Touch top leftX+ = approx. Y-
        Touch top rightX+ = approx. Y-
        Touch bottom leftX+ = approx. Y+
        Touch bottom rightX+ = approx. Y+
        Connect DVM to Y+/GND
        T ME
        No measurement; drive X+,X-
        0x0040 0x3b01
        Touch top leftY+ = approx. X-
        Touch top rightY+ = approx. X+
        Touch bottom leftY+ = approx. X-
        Touch bottom rightY+ = approx. X+

        表11. 糾正觸摸屏連接問題
        SymptomCorrection
        Touch coordinates are mirrored top-to-bottomSwap the Y+ and Y- connections
        Touch coordinates are mirrored left-to-rightSwap the X+ and X- connections
        Touch coordinates are rotated 180 degreesSwap the X+ and X- connections, and swap the Y+ and Y- connections
        Touch coordinates are mirrored diagonallySwap 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 transformationSwap 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-

        3.4) 檢測觸摸屏的操作:根據需要掃描

        在配置檢測觸摸屏操作,根據需要數字化接觸屏的位置時,寫入寄存器0x40 (ADC控制),其PENSTS=0,ADSTS=0 (請參考/數據資料的表6)。讀取寄存器0x00 (X軸)后,檢測到后續的觸摸屏操作時,/PENIRQ信號鎖存至低電平,在寫入ADC控制寄存器測量X、Y軸之前,保持低電平。

        表12. 觸摸屏檢測命令序列:根據需要掃描
        • DEMO1234 Command
          Action
          SPI data in
          Verification
          T W AC 0b01
          Demand scan
          0x0040 0x0b01
          T R AX
          Read conversion result register X
          0x8000 0x0000
          P R 
          				
                      
                          
          			
          							

          評論


          相關推薦

          技術專區

          主站蜘蛛池模板: 高要市| 承德县| 闻喜县| 光泽县| 大化| 乌鲁木齐市| 遵化市| 华安县| 罗江县| 凤阳县| 武宣县| 隆化县| 栾川县| 黎平县| 桂林市| 蒲江县| 龙海市| 湖口县| 信丰县| 丰宁| 天峻县| 蕉岭县| 巢湖市| 巍山| 饶平县| 平陆县| 三原县| 闸北区| 宁陕县| 靖宇县| 三亚市| 莎车县| 湖州市| 荣昌县| 花莲市| 额济纳旗| 罗源县| 嵊泗县| 潮州市| 富顺县| 遂平县|
          • <ul id="kmmko"></ul>