How to create a new PSoC project ?
Step 1: Create a Project
In PSoC Designer 5.2, you can create a new project with the following steps.
Click the File menu and select New Project.
Choose any desired name for the project and click OK.
Select View Catalog to select the target device. Click Select when the device has been selected.
Select your language and click OK and PSoC Designer will create your project.
Step 2: Choose a Base Device to Work With
The device editor that powers the Chip-Level view shows you the resources available on your chosen PSoC device and allows you to configure and route those resources. After you have created a project, step two is to choose a device.
Click the View catalog button.
In the Select Base Part dialog, choose the part used in your kit. The CY3210-PSoCEval1 uses the CY8C29466-24PXI. Consult your kit document for the proper device for your kit.
Click Select.
Choose Generate ‘Main’ file using C.
Click OK.
Your project opens in the Device Editor Chip-Level view. The default view has secondary windows that show all kinds of information about your project. You can move, resize, close, and arrange all of these secondary windows to suit your working preferences. The View menu contains the available windows.
Step 3: Choose and Configure User Modules
This project divides the output of a potentiometer into three regions. An LED will be off, on, or blinking depending on which of the three ranges the voltage read from the potentiometer is in. The user modules required for this project are:
PGA -A programmable gain amplifier is used to buffer the input from the potentiometer.
ADCINC - An incremental ADC is used to convert the analog input from the potentiometer to a digital value that you can use for the program logic.
Timer8 -An 8-bit timer is used to blink the LED periodically.
Global Resources
Global resources are those shared by all user modules in a particular configuration. The IDE Guide (Help > Documentation) contains a complete reference on the effect of each of the Global Resources.
Set the CPU Clock to SysClk/1. Since you left the Power Settings at its default of 5 V operation and a SysClk of 24 Mhz, the CPU will also run at 24 Mhz.
Set the VC1 clock to SysClk/3.
Set the VC2 clock to VC1/16.
Set the VC3 source to VC2 and the VC3 Divider to 256.
PGA
In the User Module Catalog (View > User Module Catalog), double click to expand the Amplifiers folder.
Right-click PGA and select Place. The PGA is placed in the first available analog block. The default placement of the user module is sufficient for this user module.
Select the PGA user module in the Application Explorer.
In the Properties window (View > Properties Window) for PGA_1, change the name of the user module to VR_PGA. Note that the user module name in the Chip-Level view updates with the new name. Right click in an open area of the Interconnect view and select Zoom In to get a close up view of the resources. Press [Alt] and click the mouse to pan the window. Right click again and select Original View to restore the original view.
Set the Gain for VR_PGA to 1.000. The PGA is used to buffer the input of the potentiometer, so the Gain is 1.
Set the Input to AnalogColumn_InputMUX_0. The input for the PGA will come from the potentiometer routed from a pin to the AnalogColumn_InputMUX_0. By default, the AnalogColumn_InputMUX_0 is routed from P0[1]. You can click the mux and select one of four pins, but the default is works for this purpose.
For the VR_PGA Reference, select analog ground AGND. For Analog Bus, choose Disable.
Click Port_0_1 in the interconnect view.
Change the name to VR_IN and click OK.
//深圳
//2013.10.10
文章评论(0条评论)
登录后参与讨论