



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Associated C ypress Board: CY Associated Pa rt Family: CY8C24894-24LFXI PSoC Designer V ersion: 5. Due: 2pm October 15, 2009
You will create a system that does the following:
LED1 is ON when only S1 is pressed LED2 is ON when only S2 is pressed LED3 is ON when both S1 and S2 are pressed together No LED is ON when nothing is pressed
Have the LCD display “Button Counter” on the first line. Have “S1 = N” and “S2 = M” on the second line where N and M are the amount of times S1 and S2 were pressed respectively.
In the next window, select part CY8C24894-24LXI through the View Catalog… button and
A dding User M odules Now add the user modules that are necessary to implement this project (an LCD, and 3 LEDs).
You should see the LCD module show up in the Workspace Explorer Screen on the right.
see all 4 user modules added in the Workspace Explorer:
other parameters for this pin. Name this pin ‘ PB2’ (to mean PushButton2) and change the Drive
have a ‘0 value when not pressed and a ‘1’ value when pressed. Click ‘OK’ in the window to make the changes. Repeat for PB1 on Port_3_5.
A dding Software Now that you have the hardware hooked up, you can write a software program to tell the microcontroller what to do. In the Workspace Explorer, Expand the Folder and Source Files Tab
Before you write any code, generate the configuration files you will need for the project. Select
These library files contain the code necessary to ‘talk’ to the user modules you have added.
Take a look at some of the Library header files to see what kind of function calls you can make to the user modules. For example, open up LED_1.h and notice you have the following function calls available for ‘talking’ to LED1:
extern void LED_1_Start(void); extern void LED_1_Stop(void); extern void LED_1_On(void); extern void LED_1_Off(void); extern void LED_1_Switch(BYTE bSwitch); extern void LED_1_Invert(void); extern BYTE LED_1_GetState(void);
You also might be interested in looking at the function definitions listed under “Library Source Files.” You will notice these are all written in an assembly language used for Cypress microcontrollers.
Now you are ready to write some code. Achieve the same functionality as the summary discussed at the top of this lab. Some help is given on the following page.
User M odule I nitialization You will need to initialize your user modules. That is, when your program starts up (or when you hit reset), what should your LEDs and LCD be doing? You should set the LEDs to be OFF and the LCD to display a message that each button has zero counts.
W iring the Boar d Your board is almost ready to work – you just need to wire it up according to how you specified your port mapping in the beginning of this lab. Wire LED1 to P30, LED2 to P31, LED3 to P32, S1 to P35, and S2 to P37. Be careful not to hook the push buttons to GND as this could potentially damage the board.
Now go to the Programmer, hit, Toggle Power and have fun pushing buttons and blinking lights!
Congratulations! You’re done!