PSOC

# Creating And Editing Your Own PSoC Components

## Overview

PSoC Creator allows you to create your own (or edit existing) components, a powerful feature which allows you to capture both hardware (VHDL hardware) and software and package it into a reusable “block” which can be dropped into other projects.

PSoC components can be created from the PSoC Creator IDE. If you are looking for a very comprehensive and detailed tutorial on how to create your own components, I would recommend the Cypress Component Author Guide. This page serves only to highlight the important bits and the things you will typically struggle with when creating your own components.

## Component File Structure

File ExtensionFile FormatDescription
.cstext, C# languageContains C# code for the component settings GUI. Uses Microsoft WinForms. Usually has a seperate file for each tab element in the settings GUI.
.resxtext-xmlUnknown?
.cystatetext-xmlContains component state rules for different PSoC chip families.
.cysym?Contains the schematic symbol of the component (the one the user sees when they drop it onto a project schematic). This is also where you specify component parameters and any associated validators (right-click on the schematic and select _Symbol Parameters_).
.cycdxtext-xmlContains an xml listing of the individual components used to build up your custom component (which are in the .cysch file).
.cysch?Contains the internals (guts) of the component. This is where you can design the hardware for your custom component in just the same way you would design the hardware for a PSoC component.
./API/.ctext, C languageContains source code that will from the API for the component. This is added to the users project when they use this component in their design.
./API/.htext, C languageHeader files for the source code.

## Special Flags

'\$INSTANCE_NAME' - The name of the component in the schematic editor (e.g UartCpDebug). This is user editable. All component API is typically prefixed with this name and an underscore (e.g. UartCpDebug_Start();, UartCpDebug_PutChar();).

## Building The Component

The build menu for components is hidden by default, right-click on the PSoC taskbar and click “Build Customizer” to show this. The component can be built by clicking the “Build All Customizers” button.

## Editing Existing Components

Make sure to rename the component in the Workspace Explorer, otherwise the name will clash with the existing component. Once you have done this, make sure to change the namespace name in all of the .cs files to the same name, as well as any other references to the project name that you find (use find/replace for this to make sure you don’t miss any!).

Watch out for validators which check inputs. These could end up excluding your custom changes which use different input ranges/values.