11 Replies Latest reply on Jan 28, 2014 7:12 PM by user_14586677

    Pull Up Problem

    jose.morales

       Hello:

      I´m using a cy8c29566-24AXI and I connected Buttons in pull Up with drivemode option in the pinout in port2 but two buttons always appear like if were Press but I don´t know why, I prove with a pull up external and I have the same result. some one know why? or how can I fix the problem?

        • 1. Re: Pull Up Problem
          user_14586677

          If your button is wired Vss to Pin, and an internal pullup exists, pin to

             

          Vdd, then detection of button closed is a logic 0 for that bit in the port.

             

          Otherwise that bit will reflect the pullup and always be at logic 1.

             

           

             

          Note use shadow registers if you have mixed I/O in the port, see

             

          following ap note for discussion.

             

           

             

              

             

                    http://www.cypress.com/?rID=2900    AN2094

             

           

             

          Regards, Dana.

          • 2. Re: Pull Up Problem
            jose.morales

             I only use the port For Buttons and use the operation & to obtaint the pin value. I prove in Pull Down and I have the same problem. First I prove the code in a protoboard and it work fine, but in the PCB I have this problem.

            • 3. Re: Pull Up Problem
              user_14586677

              You would initialize the port by writing 0xFF to it when you start program.

                 

              Also setting port pins, in the pins editor, initial state as "1". That actually

                 

              would take care of a 0xFF write to the port.

                 

               

                 

              Post your project and we can take a look at it.

                 

               

                 

              "File"

                 

              "Archive Project"

                 

               

                 

              Obviously if PCB is suspicious look at actual copper routes for the buttons

                 

              and determine if they are correct.

                 

               

                 

              Regards, Dana.

              • 4. Re: Pull Up Problem
                jose.morales

                 I attached My code

                I chek continuity between the pin and button and they have continuity. only the Pin 2[1] and P2[7] don´t work

                • 6. Re: Pull Up Problem
                  jose.morales

                  Hello

                  I try to attach the code but I can´t

                  • 7. Re: Pull Up Problem
                    user_14586677

                    Use Internet Explorer or Firefox to attach code.

                       

                     

                       

                    Chrome has problems.

                       

                     

                       

                    Regards, Dana.

                    • 8. Re: Pull Up Problem
                      jose.morales
                              Here is my code   
                      • 9. Re: Pull Up Problem
                        user_14586677

                        This line of code in button poll -

                           

                         

                           

                        if (((PRT2DR & 0b00000001) | (PRT2DR & 0b00100000) | (PRT2DR & 0b00000100) | (PRT2DR & 0b00001000) | (PRT2DR & 0b00010000)) != ( 0b00111101)){

                           

                         

                           

                        What is the test for at the end of the code ?

                           

                         

                           

                        You have buttons on P2_0, P2_2, P2_3, P2_4, P2_5, correct ?

                           

                        Note change the name in pin editor of each button to its functional

                           

                        name so when you look at pinview its clear what each pin does.

                           

                         

                           

                        Consider doing one read on PRT2DR like -

                           

                         

                           

                        keycheck = PRT2DR;                                   // Get port 2 data

                           

                        if ( ( keycheck | 0b11000010 ) != 0xFF ) break;      // If any key down break (force non

                           

                                                                             // button pin position in data to

                           

                                                                             // true in this test)

                           

                         

                           

                        Also, you do not debounce your keys in and out. Mechanical keys should be

                           

                        debounced for at least 100 mS. And do you want key to be released before you

                           

                        operate on it, code does not reflect that.

                           

                         

                           

                        Attached debounce techniques.

                           

                         

                           

                        Regards, Dana.

                        • 10. Re: Pull Up Problem
                          jose.morales

                          Hello Danna My problem  was resolved with your tips :) I've implement the debounce and it works!!! maybe exist Noise in the trace of my PCB

                          Thanks Danna is a god TIP!!! 

                          • 11. Re: Pull Up Problem
                            user_14586677

                            No gods here in the forum, all of us students.

                               

                             

                               

                            Glad to assist.

                               

                             

                               

                            Regards, Dana.