资源预览内容
第1页 / 共10页
第2页 / 共10页
第3页 / 共10页
第4页 / 共10页
第5页 / 共10页
第6页 / 共10页
第7页 / 共10页
第8页 / 共10页
第9页 / 共10页
第10页 / 共10页
亲,该文档总共10页全部预览完了,如果喜欢就下载吧!
资源描述
S3C2410 Touch Screen Driver实验平台:北京博创科技的up-star2410 开发板,此开发板带有四线的电阻式触摸屏实验目的:编写能在up-star2410开发板上运行的触摸屏驱动程序并测试,采用最原始的字符设备驱动模式。实验原理分析: 硬件上分析: 开发板上触摸屏接口分析在开发板的硬件原理图上我们可以看到触摸屏的四个接口(XP,XM,YP,YM)是通过槽引出的,如图所示,图1 开发板槽触摸屏接口开发板通过这四个引脚来和触摸屏硬件相连,触摸屏的控制器和相关寄存器是集成在ARM920T CPU内部的。 s3c2410 datasheet 关于触摸屏的描述s3c2410A是具有8通道模拟输入的10位模数转换器()。图2是cpu内部有关ADC 和触摸屏接口的图。图 2 ADC和触摸屏结构 触摸屏接口举例(也是up-star2410开发板采用的连接方式)AIN7连接触摸屏的X+引脚,而AIN5则连接触摸屏的Y+引脚。要控制触摸屏的引脚(Y+,X+,Y-,X-),就要用4个晶体管,并采用控制信号nYPON,YMON,nXPON,XMON来控制触摸屏的打开和关闭。图3是典型的连接方式图3 触摸屏的典型连接图 触摸屏工作模式1. Normal Conversion ModeNormal Conversion Mode (AUTO_PST = 0, XY_PST = 0) is generally used for GeneralPurpose ADCConversion. This mode can be initialized by setting the ADCCON and ADCTSC and completed with a readthe XPDATA (Normal ADC) value of ADCDAT0 (ADC DataRegister 0).2. Separate X/Y Position Conversion ModeSeparate X/Y Position Conversion Mode is consist of two Conversion Modes: X-Position Mode and Y-PositionMode.The first mode is operated in the following way:X-Position Mode (AUTO_PST = 0 and XY_PST = 1) writes X-position conversion data to XPDATA ofADCDAT0 register. After conversion, The Touch Screen Interface generates the Interrupt source (INT_ADC)to Interrupt Controller.Y-Position Mode (AUTO_PST = 0 and XY_PST = 2) writes Y-position conversion data to YPDATA ofADCDAT1. After the conversion, the Touch Screen Interface also generates the Interrupt source (INT_ADC)to Interrupt Controller3. Auto (Sequential) X/Y Position Conversion Mode.Auto (Sequential) X/Y Position Conversion Mode (AUTO_PST = 1 and XY_PST = 0) is operated in thefollowing way:The Touch Screen Controller automatically converts X-position and Y-position. The Touch Screen Controllerwrites X-measurement data to XPDATA of ADCDAT0, and then writes Y-measurement data to YPDATA ofADCDAT1. After Auto (Sequential) Position Conversion, The Touch Screen Controller generates Interruptsource (INT_ADC) to Interrupt Controller.4. Waiting for Interrupt Mode.When Touch Screen Controller is in Waiting for Interrupt Mode, it waits for Stylus down. The controllergenerates Interrupt (INT_TC) signals when the Stylus is down on Touch Screen Panel.After an interrupt occurs, X and Y position can be read by the proper conversion mode (Separate X/Y positionconversion Mode or Auto X/Y Position Conversion Mode).5 Standby ModeStandby mode is activated when STDBM of ADCCON register is set to 1. In this mode, A/D conversionoperation is halted and XPDATA (Normal ADC) of ADCDAT0 and YPDATA of ADCDAT1 contain the previousconverted data. 触摸屏寄存器详解图 4 是控制寄存器,主要对控制的开始和停止,以及转换的分频设置,通道设置和模式选择(一般转换还是Standby mode)图控制寄存器如图所示,是关于触摸屏控制寄存器的描述,主要是对触摸屏工作模式的设置图触摸屏工作模式设计寄存器(触摸屏控制寄)ADCTSC如图 6所示,是ad转换一次要的时间设置寄存器下面两图是对X坐标寄存器和Y坐标寄存器的详解 触摸屏的操作顺序1. Connect pads of the touch screen panel to the S3C2410X using external transistor 2. Select Separate X/Y Position Conversion Mode or Auto (Sequential) X/Y Position Conversion Mode to getX/Y position.3. Set Touch Screen Interface to Waiting Interrupt Mode,4. If interrupt occurs, then appropriate conversion (Separate X/Y Position Conversion Mode or Auto (Sequential)X/Y Position Conversion Mode) is activated.5. After get the proper value about X/Y position, return to Waiting for Interrupt Mode.以上是s3c2410 datasheet 对触摸屏的说明,我们的驱动程序也主要是对这里的5个寄存器来操作从而达到控制触摸屏的目的另外我们也发现,cpu内部的触摸屏控制器是通过四个GPIO引脚来与触摸屏相连接的,其实也就是我们之前介绍的LCD槽印出来的那四个GPIO引脚。在这里我主要想介绍一下这四个GPIO在CPU上的图。如下图所示。软件上设计分析 linux内核中有关触摸屏的一些定义(主要是对寄存器的定义),这些定义都放在asm-arm/plat-s3c/regs-adc.h中。
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号