1 Reply Latest reply on Dec 13, 2017 5:42 AM by user_78878863

    Accessing pins as array

    petrescu.c.n_2989616

      Hello everyone,

       

      First of all this my first time playing with PSoC creator or with any Cypress PSoC device. And i am really amazed: it's incredible.

      Since I have some free time these days I decided to learn about the way that this uC are programmed. So...

       

      I am blinking some leds. I saw that it's possible to access pins as a port which is quite nice. But is it possible to access them from an array?

       

      Below my code. Thank you in advance.

       

       

       

      /* ========================================

      *

      * Copyright YOUR COMPANY, THE YEAR

      * All Rights Reserved

      * UNPUBLISHED, LICENSED SOFTWARE.

      *

      * CONFIDENTIAL AND PROPRIETARY INFORMATION

      * WHICH IS THE PROPERTY OF your company.

      *

      * ========================================

      */

      #include "project.h"

      #include "cypins.h"

       

       

      int array[4]={LED_1_0,LED_1_1,LED_1_2,LED_1_3};

      int main(void)

      {

          CyGlobalIntEnable; /* Enable global interrupts. */

       

       

          /* Place your initialization/startup code here (e.g. MyInst_Start()) */

       

       

          for(;;)

          {

              for(int i=1;i<16;i++){

                  LED_1_Write(i);

                  CyDelay(1000);

              }

              for(int i=1;i<4;i++){

                  CyPins_SetPin(??);

                  CyDelay(1000);

              }       

              /* Place your application code here. */

          }

      }

       

       

      /* [] END OF FILE */