2 Replies Latest reply on Feb 13, 2015 11:19 AM by user_14586677

    changing IO pin direction in code...

    dai.vu

      Hi.  how do I change an IO pin from an output to an input pin (or vise versa) in code? 

         

      The datasheet for IO has one API called CyPins_SetPin() but its usage (API) wasn't described.  Is this what I need? 

         

      The code generated for the project (Pin_1.c) does not even contain this routine (?)

         

      This API is for use with PSoc3 and PSoC5LP which are both of the devices that I am using.

         

      Please advise.  Thank you.

        • 1. Re: changing IO pin direction in code...
          user_1377889

          Documentation about CY... constants and APIs you'll find in the System Reference Guide which is acessable from the Help-menu in Creator.

             

          On the other hand, a pin may be defined as input and output and additionally this can be controlled with an output enable (oe) signal, see at the Pins-datasheet.

             

           

             

          Bob

          • 2. Re: changing IO pin direction in code...
            user_14586677

            If you go to Architecture TRM there is a section on I/O, a summary of the registers you

               

            can write to control pin parameters.

               

             

               

             

               

             

               

            There is a Register TRM that has indepth details of the control registers and

               

            bit settings.

               

             

               

            This ap note should help as well -

               

             

               

                

               

                     

               

            http://www.cypress.com/?rID=57571     AN72382 - Using PSoC® 3 and PSoC 5LP GPIO Pins

               

             

               

             

               

            Regards, Dana.