- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wanted to re-create the blink example using the Cortex core only, no digital or analog modules. So far this is what I got but I still can't see the LED (port 2 pin2) blinking. What am I missing?
#include <project.h>
#include <cypins.h>
#include <cydevice_trm.h>
#define CYREG_PRT2_PC1 0x40005011u //define pin 2.2
#define CyPins_SetPin(pinPC) ( *(reg8 *)(pinPC) |= CY_PINS_PC_DATAOUT) //set pin
#define CyPins_ClearPin(pinPC) ( *(reg8 *)(pinPC) &= ((uint8)(~CY_PINS_PC_DATAOUT))) //clear pin
int main()
{
while(0)
{
CyPins_SetPin(CYREG_PRT2_PC1);
CyDelay(1000);
CyPins_ClearPin(CYREG_PRT2_PC1);
CyDelay(1000);
}
return(1);
}
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This Appnote can help you http://www.cypress.com/documentation/application-notes/an72382-using-psoc-3-and-psoc-5lp-gpio-pins
check page 10, section Toggle GPIOs Faster with Data Registers.
Hope it helps
Carlos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Page 7 🙂 Thank you Carlos, it worked! So in case anyone else wants to build a blink example, here it goes:
for(;;) {
/* Set MyPin output state to HIGH */
MyPin_Write(1);
/* Delay for 500 ms */
CyDelay(500);
/* Set MyPin output state to LOW */
MyPin_Write(0);
/* Delay for 500 ms */
CyDelay(500); }
Keep in mind you need to drop a pin in the schematics section first, name it (such as 'MyPin'), set it to digital out, no HW connection, strong drive. That's it! The PSOC5 API seems very useful!