Академический Документы
Профессиональный Документы
Культура Документы
Project Name: Example_CSD_TX8SW_20xx6 Programming Language: C Associated Part Families: CY8C20xx6 Software Version:PD5.0 SP3a Build 718
Project Objective
This project is aimed at scanning CapSense buttons and slider regularly and sending the data to the PC (HyperTerminal) using the TX8SW user module.
Overview
This project incorporates the CapSense module (CSD) and the TX8SW module to serially send CapSense data to the PC. The CapSense module scans all the buttons continuously and calculates the centroid position of the slider. The TX8SW module sends the status (On or Off) of each button and the centroid position of slider to the PC. On the PC, the HyperTerminal communication tool can be used to monitor the data sent by the TX8SW module.
Low BaseLine Reset Modulator Capacitor Pin iDAC Value Resolution Scanning Speed ShieldElectrodeOut PrechargeSource July 13, 2009
[+] Feedback
Example_CSD_TX8SW_20xx6
Comments This parameter determines the precharge switch output frequency. This parameter sets the PRS sequence length. Sequence length for 8 bit is 511. Autorange of capacitance measurement is disabled.
Note The parameters for CSD given in User Module Parameter Settings on page 1 are set to work without overlay on the CapSense buttons. If you have overlay on CapSense buttons in the board, use the calibration flowchart on page 7 to set these CSD parameters.
TX8SW Parameter Port Pin BaudRate Parity StopBits DataBits Port_4 Port_4_2 9600 None One 8 Value Comments Tells on which port the data is sent out. This is the pin of the selected port to send data out. This parameter sets the baud rate of the output data (bits/second). Tells the type of the parity. Possible choices are Odd, Even, and None. None indicates that parity bit is not transmitted. This parameter indicates the number of stop bits to transmit. One or two stop bits can be transmitted. This parameter indicates the length of the data during each transmission. Seven or eight data bits are supported.
Global Resources
Important Global Resources Parameter IMO Setting CPU_Clock Value 24 MHz SysClk/2 Selects 24 MHz SysClk. Selects 12 MHz as CPU Clock. Comments
[+] Feedback
Example_CSD_TX8SW_20xx6
Hardware Connections
The schematic diagram for the project follows. Figure 1: Schematic Diagram
Cmod is connected to P0[3]. A 560 Ohm resistor is connected in series with each CapSense button to reduce RF interference. The serial data transmitted by PSoC is in TTL format. But the PCs serial communication port (COM port) accepts the signal in RS232 format. Hence, MAX32321 is required for the conversion of TTL signal to RS232 signal. The pin assignment for CapSense buttons used in this project are as follows: Button 0 P1[6] Button 1 P1[3] Button 2 P3[3] Button 3 P2[1] Button 4 P2[3] The slider segments pin assignment used in this project are as follows: Slider 0 P1[4] Slider 1 P0[6] Slider 2 P0[4] Slider 3 P0[2] Slider 4 P2[6] Slider 5 P2[4] Slider 6 P2[2] Slider 7 P2[0] Slider 8 P3[2] Slider 9 P3[0]
July 13, 2009 Document No. 001-54574 Rev. ** 3
[+] Feedback
Example_CSD_TX8SW_20xx6
CY3280 20x66 Universal CapSense Controller board along with CY3280 SLM Universal CapSense Linear Slider Module is suitable for this project. CY3210 PSoCEVAL1 board is also needed for the signal conversion required between PSoC output (TTL signal) and PC's input (RS232 signal). External connections required between these boards are shown in the following block diagram. Figure 2: Block Diagram
Operation
On reset, all hardware settings from the device configuration are loaded into the device and main.c is executed. The following operations are performed by the firmware:
Global interrupt is enabled and TX8SW user module is started. CSD user module is started; finger thresholds and baselines are initialized. In an infinite while loop the following operations are done:
Scan all CapSensors. Update all the baselines. Call function TransmitStatus().
The status (On or Off) of each CapSense button is found and TX8SW user module transmits this information to the HyperTerminal. Centroid position of the slider is found and TX8SW transmits this information also to the HyperTerminal.
[+] Feedback
Example_CSD_TX8SW_20xx6
6. 7.
After selecting the com port, click on Configure to set up the connection properties such as baud rate, number of data bits, and so on. In the Properties window, click on Restore Defaults button. This configures the com port properties that are similar to the TX8SW user module properties. Figure 4: Configuring Properties of the New Connection.
[+] Feedback
Example_CSD_TX8SW_20xx6
8. 9.
Now, click on OK and return to the main window of HyperTerminal. Press any key on the keyboard to begin communication. After it starts you can see the Connected status in the status bar (left bottom corner).
10. Now power on PSoC to start the project execution. PSoC scans all CapSense buttons and slider continuously, and sends the information to the HyperTerminal. The information includes On/Off status of the CapSense buttons and slider centroid position (position of finger on the slider). Figure 5: Display of CapSense Buttons Status and Slider Centroid Position in HyperTerminal.
[+] Feedback
Example_CSD_TX8SW_20xx6
CSD Calibration
For optimum performance, the CSD parameters are tuned with the actual CapSense hardware and overlay. The following flowchart shows the steps to be performed for calibrating CSD. Figure 6: CSD Calibration Flowchart
1. 2. 3.
Start with the default settings of the CSD user module. Using I C-USB bridge or UART and the actual hardware and overlay, capture the raw counts, baseline, and difference counts for the sensors. Coarse Tuning. Check if Signal to Noise Ratio (SNR) is greater than 5. If SNR is less than 5, increase SNR by following recommended PCB guidelines, increasing the resolution of the CSD, using external CMOD, and reducing the scan speed of the CSD. For PCB guidelines refer to the application note CapSense Best Practices - AN2394. For details about SNR and how to measure SNR, refer to the application note Capacitance Sensing - Signal-to-Noise Ratio Requirement for CapSense Applications - AN2403. Check if total scan time for all the sensors meets requirement. If not, reduce resolution and/or increase scan speed. As these parameters also affect SNR, go back to the previous step. With a couple of passes, arrive at the optimum resolution and scan speed parameters that produce the best SNR and the desired scan time. Capture the difference counts when the button is activated. Set the finger threshold parameter to 75 percent of the peak. Set the noise threshold to 40 percent of the peak value.
2
4.
5. 6.
[+] Feedback
Example_CSD_TX8SW_20xx6
7. 8. 9.
Set the hysteresis to 15 percent of the peak value. Set the negative noise threshold to half the noise threshold. Set finger thresholds for individual sensors if necessary. This is done by writing to the CSD_baBtnFThreshold array in firmware.
10. Set the baseline update threshold per requirements. The frequency with which the baseline is updated must be determined on a project-to-project basis. The point of a baseline is to be a slow moving reference which helps to reduce the effects of noise and temperature on the capacitive sensor. Fast update baseline rates: This can be problematic if users move their finger slowly to the button. This is called baselining out the finger. Slow update baseline rates: This can leave the buttons vulnerable to temperature fluctuations and lead to Button Lock. 11. Set AutoReset and Debounce parameters as required. Refer to the CSD user module data sheet for details of these parameters. 12. For any other parameters refer the user module data sheet.
Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone: 408-943-2600 Fax: 408-943-4730 http://www.cypress.com/ Cypress Semiconductor Corporation, 2009. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Use may be limited by and subject to the applicable Cypress software license agreement.
[+] Feedback