2 Replies Latest reply on Feb 10, 2017 9:08 AM by greg.lőrincz

    Blink code in C

    greg.lőrincz

      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);
      }