A new way to do firmware development on programmable devices
A Sample DesignLet’s start with a simple PSoC design for illustration’s sake. PSoC Creator’s schematic capture and parameterized components make it easy to draw up this peak detector circuit.
Click on image to enlarge.
This design uses two main components: a comparator (Comp) and a mixer (Peak_Mixer). The comparator simply compares two input analog voltages and outputs a digital result. The mixer, which is configured in Sample mode, outputs the difference between its reference and input signals and updates that value on every clock cycle. Because the reference voltage is ground (Vssa) in this design, the mixer always outputs its sampled input voltage to another pin (Peak).
The output of the mixer is also fed into the reference input (-) of the comparator. When the voltage on the pin (Sig_In) is low, the comparator output is also low and the clock to the mixer is blocked by the AND gate.
As a result, the mixer does not sample the voltage and continues to output its last-sampled peak voltage. When the pin voltage is higher, the comparator changes output, the clock is no longer gated, and the mixer updates its output with the new peak voltage.
Building this design results in a number of APIs being generated. For our purposes, we just want to turn on the circuit:
1 - Comp_Start()
2 - Peak_Mixer_Start()
To write this code, we need to create the uVision project. This is done from the PSoC Creator Project menu, which offers the “Export to IDE” wizard.
Click on image to enlarge.
Figure 2: Step One - Choose the Target IDE
Click on image to enlarge.
Figure 3: Step Two - Choose Project File Names and Location
This code is not production-worthy and the hardware team may want to share it with software professionals. In other cases, the hardware teams develop useful low-level interfaces to the systems they have designed in PSoC Creator and want to export these to the application developers.
Click on image to enlarge.
Figure 4: Step Three - Export Application Code?
Click on image to enlarge.
Figure 5: Steps Four & Five - Review Actions and Launch uVision
The library project contains all the PSoC-specific details, including important API files and initialization code. When the project is built, a “*_PSoCxlib.lib” library file is generated that is linked directly with the application.
The application project is typically something of a shell when it is created (unless you export source files for PSoC Creator).
Click on image to enlarge.
Figure 6: Viewing the Exported Projects and API Files in uVision


Loading comments... Write a comment