Bailey O.H.Embedded systems.Desktop integration.2005
.pdf
410Chapter 10 / The PSoC Prototype
3.Here, we have three options: Create New Project, Clone Project, and Create Design-Based Project. This allows us to create a new part from scratch, use an existing part as the start of a new project, or clone an existing part as a starting point for a new idea. Choose Create new project and give it the name Cy8C27443Test and select the default path, which is under the current users My Documents folder. Press Next and the following dialog will be displayed.
Figure 10-9
4.By default, Assembler is selected, as is the CY8C2744312PVXE part. The characters after the hyphen indicate the part packaging. Since this is the part we will be using you can leave the entry as is. I’ve selected the C language since the compiler is installed on my system. If you haven’t purchased the compiler key, the C language choice will be grayed out. Click the Finish button and you will be taken to the main PSoC Designer screen as shown in Figure 10-10.
Chapter 10 / The PSoC Prototype |
413 |
|
|
The tabs along the bottom of the design screen present the developer with different types of design information. For example, clicking the SampleCode tab shows an assembler listing on how to interface to a Dallas 1307 clock chip using the I2C interface.
To continue our design we need to allocate pins to our I2C interface. The five colored icons at the right of the topmost toolbar control which design view we are in. The view we are currently in is the User Module view. Let’s change views to the Interconnect view, which is the rightmost icon. Our entire design area has changed to resemble the following.
Chapter 10
Figure 10-12
As you can see, the entire design screen has changed. On the far right side of the screen is an image of the chip. Different colors indicate pin usage. A legend below the image explains what each color of pin represents. In the center we have two different views of the part. The upper view shows how the internal interconnects are configured and to which pins they are connected. The graphic below shows the interconnects in a block view. There is a
414 |
Chapter 10 / The PSoC Prototype |
|
|
maximum of 12 blocks combined for analog and digital (fewer depending on the memory and pin count). On the far left side of the screen from top to bottom are global resource parameters, user module parameters, and the pin parameter list.
1.First, let’s assign a port to our I2C interface. On the left side of the design screen, select User Module Parameters and choose Port_0 for the I2C port. Next, select Port_0_0 for the SDA pin and Port_0_1 for the SCL pin. Now enlarge the view of the chip on the right side of the screen, and you will notice P0 and P1 reflect the new pin definitions, as shown in Figure 10-13.
Figure 10-13
2.We will add in the remaining user modules we need before finishing our part configuration. Let’s switch back to the User Module Selection view and add the following modules: a 1-Wire SW module, a UART module, and an SPIM module. The SPIM is a 3-Wire master module. If you try adding a second UART, a message will be displayed, telling you that there aren’t enough digital blocks available. Each UART uses
Chapter 10 / The PSoC Prototype |
415 |
|
|
two digital blocks and this part only allows a total of four digital blocks.
If we look at our resources we can see we’ve used 3 digital blocks, 0 analog blocks, 18 bytes of RAM, and about 1600 bytes of ROM. We have plenty of memory and resources available to work with. When you’ve finished adding the remaining user modules, your screen should look similar to the following.
Chapter 10
Figure 10-14
3.Now we will switch to the Interconnect view by pressing the rightmost icon on the top toolbar. We will need to place the UART and SPIM user modules in PSoC blocks. To do this, select the UART, right-click the mouse, and select the Place option. You will notice two PSoC blocks contain portions of the UART. Now repeat the same process for the SPIM by selecting the module, right-clicking the mouse, and again choosing the Place option.
416Chapter 10 / The PSoC Prototype
4.Now that we have placed the user modules in PSoC blocks, we need to connect them to global I/O lines, which are called rows. This can be done by selecting the user module parameters and selecting the global line to attach each function to. As you connect the device to the internal PSoC I/O you will see lines drawn from the block device to the associated global I/O line. Once this step is completed each global I/O line needs to be attached to a pin so it can communicate with the outside world.
This may seem like a lot of work and it is. But earlier I stated how flexible the PSoC is, and the reason for so many steps in the process is because of the large amount of flexibility. For example, if you had several blocks that collected data and then converted it to a number to be sent out through the serial bus, you would connect many of your blocks together internally but only have one or two pins for output.
I know this has been hard to follow, so let me suggest that you visit the Cypress MicroSystems web site at www.cypress.com and choose the PSoC product. There are many tutorials and online videos that can quickly bring you up to speed.
When we’ve finished adding the required user modules our design screen will look similar to Figure 10-15.
