毕业设计英文资料翻译.doc

上传人:飞****2 文档编号:78896708 上传时间:2023-03-19 格式:DOC 页数:6 大小:124KB
返回 下载 相关 举报
毕业设计英文资料翻译.doc_第1页
第1页 / 共6页
毕业设计英文资料翻译.doc_第2页
第2页 / 共6页
点击查看更多>>
资源描述

《毕业设计英文资料翻译.doc》由会员分享,可在线阅读,更多相关《毕业设计英文资料翻译.doc(6页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、Although touch screens are rapidly becoming more popular most developers have never created one 虽然触摸屏的使用越来越广泛,但是大多数开发人员并没有设计一款触摸屏。接下来就是如何使用必须的硬件和软件一步一步的设计出正常工作的触摸屏。 Touch screens are everywhere.触摸屏已经无处不在,比如说Industrial control systems, consumer electronics, and even medical devices are commonly equip

2、ped with touch-screen 工业控制系统,消费类电子产品,甚至是医疗设备,都普遍配备了触摸屏,We use touch screens every day without even thinking about i我们每天都很习惯的使用触摸屏。You might get cash at your ATM, sign for a package, check in for your flight, or look up a telephone number all by using a touch scre你在自动取款机上提取现金,签收包裹,查询航班,查询电话号码,这些都可能在触

3、摸屏上完成。 This article describes two relatively new CPU offerings that provide built-in support for touch-screen input.本文介绍两个相对较新的处理器,它们都支持内置的触摸屏输入。Ill show you how to write a software driver that will configure, calibrate, and continuously respond to touch-screen input using either of these microproce

4、ssor我会告诉你如何编写触摸屏驱动程序,测试程序,配置和校准基于这两种微处理器,最后你可以免费下载和使用这些代码,并在此基础上修改和优化。 Touch-screen technologies 触摸屏技术 Before we can begin writing a touch-screen driver we have to have some basic understanding of how the hardware works.开始编写触摸屏驱动程序之前,我们必须对基本硬件如何工作有基本的了解。许多不同的触摸技术都是触摸压力在屏幕上的触摸位置转换成有意义的数字坐标。Some of th

5、ese technologies include resistive, surface wave, infrared, and capacitive touch screen这些技术包括电阻,表面波,红外线,电容式触摸屏。若果想更详细的了解这些技术如果如果,你可以 和 。 For this article Ill focus on resistive touch screens.在这篇文章中,我们主要研究电阻式触摸屏。电阻式触摸屏使用很广泛,你会发现许多测试板和开发板都会集成这种类型的触摸屏Resistive touch screens are popular mainly because t

6、heyre inexpensive and electrically straightforward to add to your system.。电阻式触摸屏之所以这么普遍,主要是因为它们价格低廉,能够直接添加到你的系统。 Resistive touch screens are so named because they are basically resistive voltage dividers. 如此命名是因为他们基本上是用电阻来分压。Theyre composed of two resistive sheets separated by a very thin insulator

7、usually in the form of plastic micro-dot他们由两个电阻层组成,中间有非常薄的由微小颗粒组成的绝缘体。When you touch the screen, you deform the two resistive sheets just enough to make electrical contact between the当你触摸屏幕时,你使两个电阻层发生形变产生,软件就可以计算出在电阻层上短路的地方,因此通过分压就可以计算出触摸的位置There are several types of resistive touch screens with nam

8、es like four-wire, five-wire, and eight-wire.,有几种类型,比如“四线”,“五线”和“八线”电阻式触摸屏。The additional wires improve accuracy and reduce temperature drift, but the basic operation doesnt change. 这些额外的连线提高准确性,减少温度漂移,但是基本操作不会改变。In the simplest four-wire design, one resistive layer, the x-axis layer, is powered and

9、 the second layer, the y-axis layer is used as the pickup to measure voltage corresponding to the x-axis position在最简单的四线设计触摸屏中,“X轴”层作为加电使用, “Y轴”层测量电压对应于“x轴”的位置The process is then reversed and the y-axis layer is powered while the x-axis layer is used as the voltage pickup.,反过来,就是“Y轴”层通电,“x轴”层测量电压对应于

10、“Y轴”的位置。 Figure 2: Touch-screen circuit diagram 图2:触摸屏电路图 Figure 2 shows the simple circuit equivalent of a resistive touch screen. 图2显示了一个电阻式触摸屏的简单等效电路。 Note that two completely separate readings must be taken, x-axis position and y-axis position, and these readings cannot be taken in parallel with

11、 a four- or five-wire resistive touch screen注意,必须采取两个完全独立的读数,X轴位置和Y轴的位置,这些读数不能并行采取四或五线电阻式触摸屏。软件必须读一个轴的数值,然后是另一个,先后顺序不影响坐标值。 To convert the voltage produced by a resistive touch screen into a number we need an analog-to-digital converter (ADC). 将一个触摸触摸屏产生的电压转换成一个数字时,我们需要一个模数转换器(ADC)。 Until quite rece

12、ntly this ADC was nearly always external to the main CPU. 到目前为止,ADC几乎都是独立于主CPU。比如An example of such an ADC controller is the Burr Brown NS7843 or NS7846.比如Burr Brown的NS7843或NS7846。 This device is a 12-bit analog-to-digital converter with built-in logic to control a touch screen by powering alternate

13、 planes and converting from the other. 它是一个12位的模拟-数字转换器,内置的逻辑控制。 Hardware configuration 硬件配置 The first thing the touch drivers need to do is configure the hardware. 触摸驱动程序需要做的第一件事就是是配置硬件。 For these integrated controllers, this means writing to memory-mapped registers to configure the controllers to

14、a known state. 对于这些集成控制器,这意味着写入存储器映射寄存器来配置控制器状态。 This is done in a function named TouchConfigureHardware() in each driver. 这是在名为 TouchConfigureHardware() 函数中完成的。 In order to configure the hardware, we already have some decisions to make. 为了配置的硬件,我们已经作出的一些决定。 Should the driver be interrupt driven? 中断

15、应该是中断驱动的? What type of conversion rate is required to get responsive and accurate touch position information? 需要什么类型的转化速率才能得到响应和精确的触摸位置信息? As for whether or not the touch driver should use interrupts, the example drivers do in fact use the interrupt-driven approach. 至于触摸驱动程序是否应该使用中断,驱动其实使用中断驱动方式, I

16、did this mainly because, to be honest, its fun to use interrupts我这样做主要是因为,说实话,使用中断很有趣。它总是最好的或正确的设计,不要让任何人告诉你,你的触摸驱动程序“做错了”,如果它不中断驱动。 I bring this up only because it seems polling has become a dirty word to embedded systems progra我提起这事,只因为它似乎是“轮询”已成为嵌入式系统程序员的一个肮脏的字眼。 I once asked a client if he was p

17、olling or using interrupts to service an input device. 我曾问过一个客户,如果他是轮询或中断服务的一种输入设备。 The response was this is an embedded system, we dont do any polling. 回答是“这是一个嵌入式系统,我们没有做任何轮询。”I felt (temporarily) like an idiot for asking the question, but on further reflection polling is a very reasonable thing t

18、o c(暂时的)我觉得这个问题很白痴,但进一步的考虑这又是个非常合理的事情。如果你使用实时操作系统,所有你的任务都被因等待某种外部事件发生而经常堵塞,处理器就正处于空闲任务循环而不做任何有建设性的事,也许在这种情况下,更好的设计是优先处理触摸屏输入。这是一个设计合理,值得考虑但必须根据您的系统的整体要求。 How to go about configuring an interrupt varies from one operating system to another. 如何去配置中断的变化从一个操作系统向另一个。 Youll find sections of the code have

19、been #ifdefed in for each of the many supported RTOSes. 你会发现代码的部分片段已ifdefed许多支持的RTOS。 In all cases the drivers actually use two distinct interrupts: 在所有情况下,驱动实际使用两种不同的中断: 1. 1.An interrupt to wake up when the screen is initially touched, known as the PEN_DOWN interrupt 中断唤醒最初画面时,作为 PEN_DOWN 中断 2. 2.

20、第二个中断信号时,即就是ADC数据转换。 Ill describe these interrupts and how theyre generated in the following paragraphs. 我将在接下来介绍这些中断和如何产生这些中断。 The next question is how fast do we want to receive sample input readings from the ADC. 接下来的问题是我们想从ADC接收采样输入数值。速度受时钟频率影响,我们需要配置时钟来驱动触摸控制器和ADC。 We want the clock to be fast

21、enough to provide responsive input and accurate tracking but not so fast that the conversion is inaccurate or the system is consuming more power than required. 我们希望时钟速度足够快以保证灵敏的输入和精确跟踪,但太快,数据又会不准确或者是系统消耗比实际需要更多的功率。 In my experience, a touch screen needs to provide position updates to the higher-leve

22、l software at a minimum 20Hz rate, or every 50ms. 以我的经验,触摸屏需要以最低20Hz的速率向上位机提供坐标更新,或每隔50ms。 Faster is better, assuming the higher-level software can keep up, and we arent too concerned with power usage. 越快越好,假设更高级别的软件能跟上,我们都不太关心用电量。 If the touch input response is much slower than this, there will be

23、a noticeable and annoying lag between touch input by the user and visual response on the display. 如果触摸输入响应比这慢得多,由用户和触摸输入显示屏上的视觉反应之间会有一个明显和恼人的滞后。 The 20Hz update rate might not sound too challenging, but providing updates at 20Hz actually requires sampling at approximately 200Hz, depending on how man

24、y readings we are going to take before deciding we have a stable input. 20Hz的更新率可能不会听起来太具有挑战性的,但实际需要提供20Hz的更新约200Hz的采样,取决于多少读数,我们要决定之前我们有一个稳定的输入。 We need to oversample in order to debounce and average the touch input position values. 我们需要进行过采样,为了去抖动和平均触摸输入位置值。 Resistive touch screens, especially the

25、 inexpensive variety, are notoriously noisy and bouncy. 电阻式触摸屏,尤其是便宜的品种,是出了名的嘈杂和弹性。 The driver needs to sample the input for each axis several times before sending a position update to the higher-level software. 在给上网机软件发送前几次坐标位置更新时,需要多次取样各个轴的值。所提供的驱动程序默认配置各自处理器ADC时钟为最低200Hz(5ms)的采样率。 This allows the

26、 driver to sufficiently debounce and filter the incoming raw data and still provide a 20Hz true position update rate to the high-level user interface software这让驱动有充分的时间去抖动和过滤传入的原始数据,并仍然以20Hz的频率想上位机更新目前的坐标位置。 For the Freescale i.MX processor the touch controller module is named the Analog Signal Proc

27、essor (ASP). 飞思卡尔i.MX处理器被命名为模拟信号处理器(ASP)。该处理器提供了两个以核心CPU时钟分频的外设时钟。The course input to the ASP block is PERCLK2 (Peripheral Clock 2) , which can again be divided to produce the final input clock to the ASP输入到ASP块是 PERCLK2(外设时钟2), 其中又可以分为以产生最终的ASP输入时钟。 Note that PERCLK2 drives other sub-modules in add

28、ition to the ASP block, including the internal LCD controller, and therefore the touch driver cannot program PERCLK2 just for a good fit for touch sampling. 请注意PERCLK2驱动器,其他子模块的ASP块,包括内部LCD控制器,因此触摸驱动不能编程为适合PERCLK2的触摸采样。PERCLK2为所有连接的外围设备被编程,在大多数情况下,将LCD控制器所需要的最高利率,并进一步划分为较慢的外围设备的要求。 The MC9328MX1 ref

29、erence manual includes a table that specifies the clock programming values needed to achieve a 200Hz output data rate. MC9328MX1参考手册中包含了一个表,指定实现了200Hz的输出数据速率所需的时钟编程值。 Hardware configuration for the Sharp LH79524 requires programming a few GPIO pins so that they are assigned to the ADC function, prog

30、ramming and enabling the ADC clock, and programming the ADC sequencer. Is the screen touched? 触摸屏是否被触摸 Once the basic hardware setup is complete, we need a reliable method to determine if the screen is touched. 一旦基本的硬件配置完成,我们需要一种可靠的方法,以确定触摸屏是否被触摸。这是没有意义的如果用户没有触摸屏幕,运行ADC和转换的读数是没有意义的。每个控制器提都供了一种机制来检测是

31、否被触摸,如果屏幕被触摸,可选触摸中断事件发生时中断主处理器。驱动程序的功能函数WaitForTouchState()是决定屏幕是否被触摸。 When the controller is in the touch detection mode the y-axis touch plane is tied high through a pull-up resister. 当控制器处于触摸检测模式时,检测到Y轴触摸层与上拉电阻接通。x轴的触摸层与地连接。 When the user touches anywhere on the screen, the planes are shorted tog

32、ether and the y-axis plane is pulled low. 当用户触摸屏幕上的任何地方,触摸层短接在一起,并且Y轴被拉低。这可以连接内部机制作为称为 “PEN_DOWN的IRQ 中断机制。 During normal operation the drivers use the PEN_DOWN IRQ to wake up the touch driver task when a touch-down event occurs. 在正常操作期间,当触摸事件发生,驱动使用PEN_DOWN的的IRQ唤醒触摸驱动任务。一旦用户触摸屏幕This allows the drive

33、r task to block itself and not consume any CPU time when the screen is not touched and wake up and go into conversion mode once the user touches the screen.,这使得驱动程序,本身并没有触及屏幕时,不消耗任何CPU时间和唤醒并进入转换模式。 We can also save power by disabling the ADC clock while not in active conversion mode.During calibrati

34、on and active sampling the drivers use the same basic mechanism to detect a screen touch; however, in these modes the drivers mask the actual interrupt and simply check the touch status manually.校准和主动采样期间,驱动程序使用相同的基本机制来检测触摸屏;然而,在这些模式下,驱动模糊化了实际的中断和简单的手动检查触摸状态。 For the Freescale processor, this requir

35、es programming the controller to touch detect mode and checking the PEN_DOWN IRQ bit. 对于飞思卡尔处理器,这需要控制器检查触摸检测模式和PEN_DOWN的IRQ位。 For the Sharp processor, touch detection is built into the ADC command sequence and no extra steps are required.Reading touch data 读取触摸数据 During calibration and normal operat

36、ion, we need a procedure to read and debounce the x- and y-axis raw data values and determine if we have a stable reading while the screen is touched. 在校准和正常运行时,读取x和y轴值的原始数据,并确定屏幕被触摸时,如果我们有一个稳定的读数。 This procedure is named TouchScan() in both drivers. 此过程在每一驱动中都被命名为TouchScan()。 The outline of this pr

37、ocedure is: 大致过程如下: 1. 1.请检查屏幕是否被触摸。 2. 2.等待数据转换完后,读取每个轴的数值。 3. 3.检测屏幕是否被触摸。 While performing analog-to-digital conversions, both controllers provide means to program a delay between powering the touch planes and beginning an actual analog-to-digital conversion. 在完成模数转换时,每个控制器都提供了在触摸层供电和模拟-数字转换之间的延迟

38、编程的方法。 Freescale calls this delay the Data Setup Count (DSCNT) , and its a number of ASP input clocks to delay after switching between planes. 飞思卡尔称这种延迟为DSCNT,这是一个ASP输入时钟的数量。 Sharp calls this the pre-charge delay . In either case this time delay is needed because the resistive touch panel is two lar

39、ge conductors separated by a thin insulator, which is the textbook definition of a capacitor. 在这两种情况下,这需要时间延迟,因为电阻式触摸屏是由薄绝缘层隔开的两个大的导体,让这个电容解决稳态时,需要一个延时。校准 Resistive touch screens require calibration. 电阻式触摸屏校准。 We need some reference values to be able to convert the raw A-to-D numbers weill receive i

40、nto screen pixel coordinates required by the higher-level software我们需要一定的参考值,能够转换原始的从触摸屏上接收到的模数转换值到上位机。 In an ideal case the calibration routine might be run once during initial product power-up testing, and the reference values saved to nonvolatile memory.在一个理想的情况下,校准程序可能会运行一次,在最初的产品上电测试中,参考值也保存到非易

41、失性内存中。我在整理触摸屏驱动程序的整个过程中,只运行了一次校准程序,但要记住,你可以保存的参考值,在随后的上电中,用户不用再次校准。在任何情况下,由于温度漂移或其它因素,校准变得不准确的,你会想到给用户提供一种进入校准程序的方法。 The calibration routine, named CalibrateTouchScreen() , is a simple step-by-step procedure that provides the user with a graphical target on the screen, asks the user to touch the tar

42、get, and records the raw ADC readings for use later in our raw-data to pixel-position scaling routine. 校准例程,名为CalibrateTouchScreen(),是一个简单的一步一步的过程,它给用户提供了屏幕上的图形目标,要求用户触摸目标。 The graphical target and user prompts are displayed by using the Portable Embedded GUI (PEG) graphics software API, but this ca

43、n be implemented using any similar graphics software使用移植式嵌入式图形用户界面(PEG)图形软件API显示图形目标和用户提示,但是这是应用于任何小的图形软件。 In a perfect world wed need only two sets ( x and y ) of raw values, the minimum and maximum values read at opposite corners of the screen. 在显示生活中,我们只需要两个原始值(X和 Y)和读取屏幕的相对角的最低和最高值。 In reality m

44、any resistive touch screens are notably nonlinear, meaning that simply interpolating positions between the min and max values will yield a highly inaccurate driver. 在现实中,许多电阻触摸屏,特别是非线性的,也就是说,只需最小值和最大值之间的位置插值,就将产生一个不准确的驱动。 By nonlinear, I mean that equidistant physical movements across the screen won

45、t return equal increments in the raw data. 通过非线性,我的意思是,在屏幕上的等距物理运动将不会返回等价原始数据递增。 Worse still, the value read for one axis, say the y-axis, might vary significantly even if we only change the x-axis touch position. 更糟的是,即使我们只改变X-轴的触摸位置 读出的y轴值可能也会有明显变化。 To demonstrate this phenomenon I charted y-axis

46、data readings as I moved a stylus across a typical resistive touch screen from left to right, keeping the y-axis position as constant as possible. 为了证明这一点我绘制y轴数据 我在一个标准的电阻触摸屏用笔从左至右滑动,保持Y轴的位置尽可能不发生变化。 You would reasonably expect the y-axis readings to remaining somewhat constant as we slide from left

47、 to right across the x-axis, but as Figure 3 shows this is not the case.,我们通过X轴从左至右滑动,你可能会认为Y轴读数据会不变,但图3显示了这种情况并非如此。 Figure 3: Y-axis variation with x-axis motion 图3:随着x轴运动Y轴的变化The result of this is that the more calibration points you can take the better, to minimize the span of your interpolation

48、windows and produce the best accuracy possible. 结果显示,校准点越多,数据越理想,以尽量减少插补跨度和产生可能的最佳精度。 If you can calibrate once in the factory, taking a lot of sample points isnt a big deal.如果你能在出厂时校准一次,采取了很多样本点是没什么大不了的。 If thats not possible youll have to decide how many points you want to force your user to enter

49、 to produce an accurate calibration.如果这是不可能的,你必须决定多少交校准点,你要强迫你的用户输入,以产生精确的校准。 The provided calibration routine uses four data points, one at each corner of the screen. 所提供的校准例程使用四个校准点,每个点分别在屏幕上的每个角落。 This produces results accurate to within a pixel or two on a VGA resolution (640x480) display screen on the reference boards described. 这将产生一个像素或两个VGA分辨率(640480)显示屏幕上描述的参考板内准确的结果。 For higher screen resolutions or other touch screen

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁