Programming a Cypress PSoC using PSoC
Designer
Steven Shane
ECE 480, Spring 2009, Michigan State University
Key words: PSoC, Cypress, Control system
Introduction and Purpose.....................................................................................................3
The Hardware......................................................................................................................3
PSoC IDE and Designer......................................................................................................4
Example 1:.......................................................................................................................4
Application 1: Implementation of a simple Heater......................................................5
Schematic...........................................................................................................................10
Driver Schematics..........................................................................................................10
Introduction and Purpose
The Cypress-manufactured Programmable System on a Chip (PSoC) is a useful
tool for a series of engineering applications ranging from simple power regulation to
complex control applications. The on-board electronics allow for customization of the
chip’s functions. This customization can take the form of user-defined scripts, a network
of pre-defined electronic components, or a combination of the two. The object of this
note is to provide the reader with useful information on constructing a customizable
control system featuring multiple inputs and outputs.
The Hardware Analog and digital blocks:
The PSoC used in this
reconfigurable space which can be
application note is of the CY8C29X66
assigned
family of chips produced by Cypress
Figure 1: Overview of the PSoC
Semiconductors, incorporated into a
demonstration board. More recent
families with varying abilities and specs
are also available, but the core of the
product remains the same.
The PSoC is characterized by
containing the following components.
The Core: A microcontroller that
includes the clock and various timers.
PSoC IDE and Designer
The PSoC programmer and design IDE are both available as a free download
from the Cypress website, and these two programs are the focus of this document.
PSoC Designer is the application that allows the user to define interior chip logic,
placing isolated components and assigning the footprint of the chip. To start work on
defining the interior logic, create a new project.
The chip-level approach allows for a more robust control of modules added to the
programmable memory. PSoC Designer comes equipped with a series of pre-
programmed components that can simply be dragged into memory locations.
Example 1:
Each component takes up a certain amount of space, represented by the gray
boxes in the figure above. Note that analog operations (such as DTA conversion) takes up
space in the Analog Programmable region as opposed to the Digital Programmable
region. Pictured above is a 12-bit A-to-D converter placed in memory space. Unless
specified otherwise, Designer automatically allocates memory and required I/O ports.
User-defined modules can also be added to the library using the editor. Once the
components are placed, pin placement can be managed by building the project (F7).
A higher-level approach is the system-level design. In this mode, The user does
not manage the memory of the PSoC’s resources as directly, but instead a project
flowchart is automatically generated. The user drags pre-defined components into the
design window as before, except now the components are strictly Inputs, Outputs,
Valuators, and Interfaces.
Inputs range from simple digital banks to temperature sensors, accelerometers, or
even simple voltage or current inputs. These are each configured by selecting the proper
module from the toolbar, and then adjusting the characteristics of the input to match your
specific project needs.
Outputs can be any digital or analog signal generated by the PSoC. A transfer
function of some kind is required for each output, and these are typically determined by
valuators.
Valuators are logical constructions. They link outputs with inputs in logical
expressions and even blocks of C code.
Application 1: Implementation of a simple Heater
A heater is to be driven by the PSoC, controlled by an on/off switch, and with
output based upon the ambient temperature.
Inputs Outputs Valuators
Binary switch as on/off 0-5V DC output to drive Look-Ahead when the system
control a current-controlling is first initialized
MOSFET
Ambient temperature as
measured by thermistor
The figure below shows the completed display in Designer. The orange lines
denote dependencies determined by the transfer function of the valuators and outputs.
Figure 2: System-level Design
In this case, a LoopDelay valuator is used to monitor the on/off switch. It turns
high when the state of the switch changes. The output is the PWM DTA voltage, and it is
controlled by a priority encoder. The final logic is depicted below.
Application 2: Feedback-controlled thermal regulation
A more complex system that takes further advantage of the PSoC’s parallel
capabilities. Temperature is regulated by thermoelectrically-heated or cooled water
circulated through tubes in a garment. The thermoelectric is controlled by the PWM DC
output of the PSoC via a MOSFET. The figure below shows the Design window for this
particular application.
Temperature Inputs:
WaterTemp2 AmbientTemp2 BodyTemp2
Monitors output from Basis for check on Monitors the temperature of
Thermoelectric element Heating/Cooling mode. air inside the garment.
Capped at 45 degrees C Basis for fine-tuning PWM
duty cycle
All thermistor inputs are modeled after McShane TR-67 15K thermistors.
Resistance/Temperature chart http://mcshaneinc.com/html/TS67_Specs.html
Other Input(s)
4-state Dipswitch
User manual override. The four settings correspond to Cold, Off, Low Heat, and High
Heat, respectively. High at 2.2 V
Outputs
DC output H-bridge state
PWM-generated 0-5V, determined by duty Binary bit determining polarity of voltage
cycle, regulates a high-power MOSFET across TE. Determined by heating vs.
cooling mode.
The completed schematic based upon the specified design is automatically generated
when the project is built. Appendix A contains the full schematic for this project, along
with recommendations for external electronics based upon the drivers provided by
Cypress.
Appendix A
Schematic
Driver Schematics
AmbientTemp AmbientTemp2 BodyTemp
AmbientTemp AmbientTemp2 BodyTemp
Output1 WaterTemp