新聞中心

        EEPW首頁(yè) > 模擬技術(shù) > 設(shè)計(jì)應(yīng)用 > How to build a simple, interactive digital vol

        How to build a simple, interactive digital vol

        作者: 時(shí)間:2010-08-12 來(lái)源:網(wǎng)絡(luò) 收藏
        This application note uses the MAXQ2010 microcontroller's evaluation (EV) kit Rev D to implement a . The article demonstrates how to measure the voltages with the ADC and display them on the EV kit's LCD. An onboard 5-way switch is used to select the ADC channel to be displayed on the LCD. No additional parts are needed aside from the EV kit.

        -- ======================================================================= -->-- CONTENT: DB HTML -->-- ======================================================================= -->Download an example project with the code described in this application note.

        Introduction

        The MAXQ2010-KIT showcases the MAXQ2010 microcontroller. The kit has a versatile board with the following features:
        • Two pushbuttons for reset and interrupt lines
        • One 5-way switch
        • 19 exposed GPIO pins
        • Eight ADC channels
        • A photocell
        • A thermistor
        • An LCD screen
        Using these resources it is to build a .

        The MAXQ2010's integrated ADC accepts a voltage from 0V to 3.3V and translates it into a bit value from 0 to 4095 (12 bits of precision). The microcontroller then scales the value to a range from 0 to 3.3000 and writes it on the board's LCD. The application code repetitively samples all eight ADC channels and uses the 5-way switch to determine which channel to display.

        Aside from the EV kit, no additional parts are required. Included in the EV kit is a limited version of the IAR Embedded Workbench® software. The full version of the software can be purchased from the IAR website. The sample application was written and compiled on version 2.20I.

        Getting started

        Set up the board according to the EV kit documentation. You should also install jumpers J30 and J31, which will connect the photocell (R17) to ADC input 6 (AN6) and connect the thermistor (R20) to ADC input 7 (AN7). You can also add voltages on ports 0C5, as long as the voltages stay within the 0V to 3.3V range.

        Next, run the IAR software. In the top left corner click File Open Workspace. Navigate to the directory containing the project and open voltmeter.eww. The project settings will already be set up. To ensure that the JTAG is set to the correct COM port, right click on the bold-faced project name on the left side of the screen and select Options (Figure 1). Go to Categories, click JTAG under Debugger, and enter the COM port to which your programmer is connected (Figure 2). To check which COM port is being used, open Device Manager. The EV kit documentation details how to get there.

        Figure 1. To verify that the JTAG is set to the correct COM port, start with the Options menu.
        Figure 1. To verify that the JTAG is set to the correct COM port, start with the Options menu.

        Figure 2. Find the JTAG option and enter the COM port to which your programmer is connected.
        Figure 2. Find the JTAG option and enter the COM port to which your programmer is connected.

        Next, click Debug on the far right side of the toolbar (Figure 3). This will compile, link, and program your board. The debug menu will be brought up momentarily. A green arrow will be pointing to the main function. Run the program by pressing F5 or clicking the button on the toolbar that looks like a flat piece of paper with three arrows above it.

        Figure 3. Use the Debug command to compile, link, and program your EV kit board.
        Figure 3. Use the Debug command to compile, link, and program your EV kit board.

        Application results

        Featured on the EV kit board are two analog inputs, the thermistor and photocell, which continuously output voltage signals. Both of these inputs are connected to ADC pins so their voltage can be measured. The sample application reads eight ADC values (on channels 0 through 7) at a time. The values are sent to a software lowpass filter that removes high-frequency noise. The selected ADC channel is displayed on the LCD. On the lower right-hand corner of the board is a switch. Pressing this switch down or to the right increments the ADC channel to be monitored. If the channel selected is greater than seven, the software selects channel zero instead. Conversely, pressing the switch up or to the left decreases the ADC channel; channel seven is monitored if the channel selected is less than zero. To display the current channel being monitored, press in the switch. To stop the ADC from sampling, hold the button SW3 down. While SW3 is held down, the channel can still be changed.

        After reset, the microcontroller displays the photocell voltage on channel six. The more light the cell receives, the lower the voltage is across it. Effectively, the voltage at the ADC pin is directly related to the amount of light present. This is because the photocell is part of the voltage-divider on AN6 (see Figure 4). In fluorescent lighting, the voltage will sit around 2V. If you shade the corner of the board that contains the cell, the voltage will drop a bit; completely covering the photocell with your finger will drop the voltage to approximately 0.5V. Removing your finger will return the voltage to 2V.

        Figure 4. The voltage-divider and the equation that determines the voltage.
        Figure 4. The voltage-divider and the equation that determines the voltage.

        上一頁(yè) 1 2 下一頁(yè)

        關(guān)鍵詞: interactive voltmeter digital simple

        評(píng)論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉
        主站蜘蛛池模板: 金昌市| 三江| 阿勒泰市| 大庆市| 抚顺县| 宜州市| 凉城县| 邵阳县| 离岛区| 兴安盟| 长乐市| 安阳县| 喀什市| 普洱| 吐鲁番市| 阜南县| 临安市| 无为县| 新郑市| 黄石市| 安吉县| 栾川县| 海门市| 洪泽县| 大名县| 怀柔区| 楚雄市| 舒城县| 木里| 修文县| 怀仁县| 乌什县| 河南省| 旬阳县| 东山县| 元阳县| 大石桥市| 宾阳县| 千阳县| 辽阳县| 闽清县|