10 Replies Latest reply on Jan 16, 2015 5:33 PM by ki.leung

    drive mode

    user_340958977
              i read many post and documents about this, but i still have problem to change drive mode in Runtime. i write PRT0DM0 | = 0x01; PRT0DM1 | = 0x01; PRT0DM2 & =~0x01; for pull-Up but it doesn't change. the only way to set pull-up or pull-down is from chip page. pins are not connected to digital block and interrupt are disabled during the operation Any ideas?   
        • 1. Re: drive mode
          user_14586677

          Post your project -

             

           

             

              

             

                   

             

           

             

          “File”                                                           Designer

             

          “Archive Project”

             

           

             

           

             

          This may help -

             

           

             

              

             

                   

             

              

             

                   

             

          http://www.cypress.com/?rID=2900     AN2094 - PSoC® 1 - Getting Started with GPIO

             

           

             

          In the routing inspector is the pin connected to the input or output global buss ?

             

           

             

          Are you trying to connect a pin under SW to a buss ? If so you would use PRTxGS.

             

           

             

          Look at the Register TRM and Architectural TREM fopr more info.

             

           

             

          Regards, Dana.

          • 2. Re: drive mode
            user_340958977
                    pins are not connected to digital block or bus and this is not done from sw   
            • 3. Re: drive mode
              user_14586677

              Maybe I am confused of what you are trying to accomplish.

                 

               

                 

              If pins are totally unconnected to anything or the internal routing.....?

                 

               

                 

              Regards, Dana.

              • 4. Re: drive mode
                user_340958977
                        pins are nconnected, just inputs read with RD register   
                • 5. Re: drive mode
                  user_340958977
                          seems that with pullup or pull down need to set initial value too, but is not possible to set it by code...only the DR is available to have a signal, but at the end i have the output ON and is no possible to use as input   
                  • 6. Re: drive mode
                    ki.leung
                            One of my old project needs to change the output mode and has no issue doing that. what is the output circuit and how do you test if the output changed to what you want?   
                    • 7. Re: drive mode
                      user_340958977
                              yes, but in this case i need to change input...when "initialvalue" in chip is set to 1 i have a voltage vlaue output about 1,8V from pin and i can read GND or VCC in input with 1K resistor because this voltage value is in the middle from high and low status. if i write RD register i have 2,9V (output on) and is possible to read low input only with ground directly connected   
                      • 8. Re: drive mode
                        ki.leung

                        1. If you want to have a input, why not use the Hiz input?

                           

                        2. If you want to use the pin as input with pull down or pull up. While I didn't do it beofre, I would think try the following 

                           

                        a.. set the mode as input first from the desinger,

                           

                        b. then set the mode to pull up with your software and

                           

                        c..also set the FET of the other size off. 

                           

                        For example you want to use a pull up, you set the mode to pull up and then set the output to high, then FET on the low set would be OFF, you should now have a internal resitor(~5k6) to VCC. however remember that the voltage on the pin would seems like having a voltage divider, unless your signal has a low impedance.

                        • 9. Re: drive mode
                          user_14586677

                          Don't forget if you have mixed I/O in the port, and do read modify writes

                             

                          to port, to use shadow registers, discussed here -

                             

                           

                             

                              

                             

                                    

                             

                          http://www.cypress.com/?rID=2900     AN2094 - PSoC® 1 - Getting Started with GPIO

                             

                           

                             

                           

                             

                              

                             

                                    

                             

                          https://www.youtube.com/watch?v=tei6q5M3C0g       Shadow Registers

                             

                           

                             

                           

                             

                          Regards, Dana.

                          • 10. Re: drive mode
                            ki.leung

                             Do you want to use the input as digital input or analog input?