You are on page 1of 25

PSoC 3 / PSoC 5 : Architecture Overview

PSoC 3 / PSoC 5 Platform Architecture

On-board DMA Controller Highly configurable clock tree


Flexible, automated clock gating.
Direct memory transfer between peripherals offloads CPU operation, lowering power consumption

Universal Digital Blocks


Implement features in hardware that reduce CPU processing requirements, lowering power consumption

Cached Operations
Execution from flash memory is improved by caching instructions (PSoC 5 only)

Precise CPU frequencies


PLL allows 4,032 different frequencies; tunable power consumption

Integrated Analog, Digital and Communication Peripherals


Reduce external component counts and lower overall system power consumption

PSoC software
PSoC Designer is the first generation software IDE to design and debug and program the PSoC 1 devices. It introduced unique features including a library of pre-characterized analog and digital peripherals in a drag-and-drop design environment

PSoC Creator is the second generation software IDE to design debug and program the PSoC 3 and PSoC 5 devices. The program that allows the user to select, configure and connect existing circuits on the chip and the components which are the equivalent of peripherals on MCUs.

PSoC Creator will synthesize, place, and route components automatically


Example:

32-bit PWM GP Logic 16-bit PWM GP Logic UART #3 GP Logic UART #1 GP Logic UART #2

LCD Segment Drive GP Logic I2C Slave

16-bit Shift Reg. GP Logic

SPI Master

Digital subsystem before configuration

Digital subsystem after configuring the blocks

Project Steps involved in designing a application Using PSoC Creator:


1.Creating a New Project 2.Adding Components 3.Connecting Components and Chip Resources 4.Assigning Pins 5.Add Firmware in PSoC Creator 6.Building and Debugging theProject

Let us discuss First application of Psoc


Example:

Blinking LED using the above Project Design steps

1.CREATING A NEW PROJECT

The PSoC Creator Start Page has a link that enables one to create a new project as shown in the figure above. Alternatively, a new project can also be created by going to File > New>Project.

NAMING THE PROJECT

Once the new project is created, a window appears like the one shown above. Select Empty PSoC 3 Design and Assign your project a name

Selecting the Device board

Click on the expand button next to Advanced. For example CY8C3866 is the device included with the DVK1 board, select that device for this project.

PSoC Creator generates the associated directories and files needed for your project and opens into schematic view

2.Adding components
Adding a Clock Component
Drag the Clock component from the Component Catalog (System group)onto the schematic.

Adding a PWM Component


Locate the PWM component under the Digital Functions section of the Component Catalog. Drag it onto your blank schematic sheet. connect the clock component to PWM component as shown below.

Configure the PWM component as shown below

Adding a Digital Pin Component


Drag a Digital Output Pin component from Ports and Pins folder of the Component Catalog

Configure the Digital Output Pin

3.Connecting Components and Chip Resources

Connecting the PWM Component to the PWM_Pin

The PWM_Timer needs an additional logic signal


From the Digital Logic group, drag an instance of the Logic Low 0 component onto your design. Connect the Logic Low 0 component to the reset terminal of the PWM_Timer.

Add an Interrupt component from the Systems group in the Component Catalog. Connect its terminal to the interrupt terminal of the PWM_Timer component. Previously you set this terminal to generate a signal on terminal count. Rename this component to isr_PWM. LED_Pin Add another Digital Output Pin component from the Ports and Pins group to your design. Double click the pin component and change the Name to LED_Pin. This LED_Pin to be software controlled, so deselect the HW Connection setting on the Pins Type subtab. Add a Digital Input Pin component to your design, name it as Button_Pin Set the Initial State to High (1). When you press the button, the pin is grounded and the state goes low.

4.Assigning Pins
PSoC Creator to route the pins to match the connections available on the Development kit board Steps for assignment of Pins for blinking LED Application

1.Double click on the filename.cydwr (Cypress design-wide resources) file from the
Workspace Explorer. 2. Select the Pins tab at the bottom to show the pin configuration of the project. You will see a graphic of the CY8C3866(device number ) PSoC with a description of the I/O pins and routing results. 3. Select P1[5] for the PMW_Pin , P1[6] for the LED_Pin , and P1[2] for the Button_Pin.

5. Adding Firmware
PSoC Creator generates much of the code needed for this project. Open main.c by double clicking the main.c icon under Source Files folder in the Workspace Explorer.

#include <device.h> #include "timing.h void ToggleLed(void); void main() { InitTiming(); /* interrupt */ PWM_Timer_Start(); /* source of interrupt */ CYGlobalIntEnable /* macro */ for(;;) /* main loop - do forever */ { /* This section contains code to be executed every millisecond */ if(milliSecond) { milliSecond = 0U; } /* end of millisecond section */ /* This section contains code to be executed every tenth second */ if(tenthSecond) { tenthSecond = 0U; /* Toggle the LED if the button is NOT pressed. This will cause the LED to blink rapidly when the button is NOT pressed.*/ if(Button_Pin_Read()) /* read a 1 when button is NOT pressed */ { ToggleLed(); } } /* end of tenth second section */ /* This section contains code to be executed every second */ if(oneSecond) { oneSecond = 0U; /* Toggle the LED if the button IS pressed. This will cause the LED to blink slowly when the button IS pressed.*/ if(!Button_Pin_Read()) /* read a 0 when button IS pressed */ { ToggleLed(); } } /* end of onesecond section */ } /* end of do forever loop */ } /* end of main */

void ToggleLed(void) { /* Set the pin to the opposite of what is read from the pin. The pin value is always right-justified to the LS bits.*/ LED_Pin_Write(LED_Pin_Read() ^ 1U); } /* end of ToggleLed */

6.Building and Debugging Your Project


On the DVK1 development board, connect a wire from P1_5 to the top of LED1. Connect a wire from P1_6 to the top of LED2. Connect a third wire from P1_2 to SW1 .SW1 is a momentary, normally open button that will short the signal to ground when pressed. We have configured our button component to supply an internal pull up resistor for SW1.

Select Execute Code from the Debug menu of PSoC Creator Executing code will build the project if any changes have been made to source files or any configuration.It will program the target device and will halt at the main label in main.c.

You might also like