Objective: Ce195277 - Delta Sigma Adc in Single-Ended Mode With Psoc 3/psoc 5Lp
Objective: Ce195277 - Delta Sigma Adc in Single-Ended Mode With Psoc 3/psoc 5Lp
Objective: Ce195277 - Delta Sigma Adc in Single-Ended Mode With Psoc 3/psoc 5Lp
Objective
This code example demonstrates how to use the Delta Sigma ADC (ADC_DelSig) Component to take samples of an analog
input and send those samples to a PC application over RS-232 via the UART Component.
Overview
This code example implements a simple data collection system using the ADC_DelSig and UART Components. The ADC
continuously samples an analog input. The resulting samples can be sent to a PC over a UART connection, a single sample at
a time or continuously. Emulated data, which is simply an incrementing number, can also be sent over the UART connection to
test the communication. The UART is used to create an RS-232 connection to a terminal program on a PC. The terminal
program is used to send commands to get the ADC sample data and read the resulting responses.
Requirements
Tool: PSoC® Creator™ 4.2
Programming Language: C (Arm® GCC 5.4.1)
Associated Parts: PSoC 3 and PSoC 5LP parts
Related Hardware: CY8CKIT-059, CY8CKIT-001, CY8CKIT-050, CY8CKIT-030
Hardware Setup
Connect a voltage source to P0[0] on the kit. If P0[0] is not available, you can change the Vin pin in the Design-Wide
Resources file (CE195277_ADC_and_UART.cywdr). If a voltage source is not available, you can test the UART connection
using the emulated data by sending ‘e’ or ‘E’ over the terminal connection. The ADC is configured to accept a voltage input
from 0 V up to VDD of the part. Do not exceed VDD of the part.
This code example is targeted at the CY8CKIT-059 PSoC 5LP Prototyping Kit. If you are using this kit, then no external
hardware connections are needed to allow UART communication. If you are using a different hardware platform, you may
need to connect the UART Tx (P12[7]) and Rx (P12[6]) to an RS-232 interface.
If you are not using CY8CKIT-059, you may also need to target a different PSoC device. To do so, right-click the project in
Workspace Explorer and select Device Selector. Select the appropriate PSoC device for your hardware platform.
Software Setup
To interface with the UART on the PSoC device, a terminal emulator application is needed. HyperTerminal and PuTTY are
examples of valid options. Open up a connection to the COM port number that the PC gives to the PSoC device when it
enumerates. Make sure the settings in the software COM port match the settings for the UART Component, detailed in
Components and Settings.
Operation
1. Connect the board to the PC using the USB connector of KitProg. On CY8CKIT-059, this is the PCB-USB connector.
2. Program the example project to the board. In PSoC Creator, go to Debug > Program. In the dialog that appears, connect
to the KitProg associated with the kit being used.
3. Connect an external voltage to the PSoC 5LP target device on P0[0].
4. Open a terminal emulator on the PC and connect to the virtual COM port, enumerated as a part of KitProg.
5. Type character “C” or “c” in the terminal emulator to receive one sample of ADC data.
6. Type character “S” or “s” in the terminal emulator to receive continuous samples of ADC data.
7. Type character “X” or “x” in the terminal emulator to stop receiving ADC samples.
8. Type character “E” or “e” in the terminal emulator to receive one emulated sample of data. This data will increment by 1
each time an emulated sample is requested.
The code example uses the ADC_DelSig Component to sample the analog input and the UART Component to transmit the
sampled data to the PC over RS-232. See Figure 1 for details on the design schematic.
All firmware for the code example is implemented in main.c. The firmware performs the following functions:
1. Starts the ADC and UART Components.
2. Checks for ADC end of conversion. Stores the latest result if conversion is complete.
3. Checks for UART input.
'C' or 'c' received: Transmits the last sample via the UART.
'S' or 's' received: Continuously transmits samples as the conversion is completed.
'X' or 'x' received: Stops continuously transmitting samples.
'E' or 'e' received: Transmits a dummy byte of data.
For information on the hardware resources used by a Component, see the Component datasheet.
Table 2 shows the pin selections for the code example.
Table 2. Pin Selections
Related Documents
Application Notes
AN84783 – Accurate Measurement Using Shows how to increase the accuracy of DelSig measurements
PSoC 3 and PSoC 5LP Delta-Sigma ADCs
AN61102 – PSoC 3 and PSoC 5LP – ADC Describes how to buffer data from the DelSig using DMA
Data Buffering Using DMA
AN58304 – PSoC 3 and PSoC 5LP – Pin Provides an overview of analog routing in PSoC 3/5LP and recommendations for pin
Selection for Analog Designs selection
AN58827 – PSoC 3 and PSoC 5LP Internal Shows how to choose the best routes for analog-sensitive designs
Analog Routing Considerations
AN68403 – PSoC 3 and PSoC 5LP Analog Shows how to calibrate the analog signal chain in PSoC 3/5LP
Signal Chain Calibration
Code Examples
Device Documentation
PSoC Resources
Cypress provides a wealth of data at www.cypress.com to help you select the right PSoC device for your design and quickly
and effectively integrate it into your design. For a comprehensive list of resources, see KBA86521 – How to Design with
PSoC 3, PSoC 4, and PSoC 5LP. The following is an abbreviated list:
PSoC Creator
PSoC Creator is a free, Windows based Integrated Design Environment (IDE). It enables you to design system hardware and
firmware concurrently based on PSoC 3, PSoC 4, PSoC 5LP, and PSoC 6 MCU (see Figure 2). With PSoC Creator, you can
do the following:
1. Drag and drop Components to build your hardware 3. Configure Components using configuration tools.
system design in the main design workspace. 4. Explore the library of 100+ Components.
2. Codesign your application firmware with the PSoC 5. Review Component datasheets.
hardware.
Figure 2. PSoC Creator Features
Document History
Document Title: CE195277 - Delta Sigma ADC in Single-Ended Mode with PSoC 3/PSoC 5LP
Document Number: 001-95277
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
© Cypress Semiconductor Corporation, 2015-2018. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including
Spansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“Software”), is owned by
Cypress under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such
laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other
intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with
Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to
sublicense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for
use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end
users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of
Cypress’s patents that are infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for
use with Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD
TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. No computing device can be absolutely secure. Therefore, despite
security measures implemented in Cypress hardware or software products, Cypress does not assume any liability arising out of any security breach,
such as unauthorized access to or use of a Cypress product. In addition, the products described in these materials may contain design defects or
errors known as errata which may cause the product to deviate from published specifications. To the extent permitted by applicable law, Cypress
reserves the right to make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of
any product or circuit described in this document. Any information provided in this document, including any sample design information or programming
code, is provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality
and safety of any application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as
critical components in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or
systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances
management, or other uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A
critical component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or
system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim,
damage, or other liability arising from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and
against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of
Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are
trademarks or registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit
cypress.com. Other names and brands may be claimed as property of their respective owners.