1 2 Previous Next 19 Replies Latest reply on Nov 20, 2012 4:52 AM by cathal.ferry Go to original post
      • 15. Re: Psoc rangefinder
        ki.leung

        if (distance is 10cm or less) {

           

        level high

           

        }

           

        else if  {                     //(distance is 15-30cm)

           

        level is medium

           

        } else if {

           

        ......

           

         

           

        }

           

         

           

         

           

         

           

        What is between 10cm and 15cm?

        • 16. Re: Psoc rangefinder
          cathal.ferry

          hi,

             

          between 10-15 is a medium level for example. would that not be

             

          else if {

             

          distance is greater than or equal to 10 and less than or equal to 15cm level is medium.

             

          }

             

          i would probably need to use the .asm equivalent though if i plan to modify the code etc

          • 17. Re: Psoc rangefinder
            user_14586677

            Basically look like this -

               

             

               

            BYTE cDistance = 0;

               

             

               

            if ( cDistance < 10 ) {

               

            .......

               

            } else if ( ( cDist >= 10 ) & ( cDist < 15 ) ) {

               

            .......

               

            } else if ( cDist >= 15 ) {

               

            .......

               

            }

               

             

               

            Regards, Dana.

            • 18. Re: Psoc rangefinder
              cathal.ferry

              hi Dana,

                 

              Thanks for your reply,

                 

              I had a look at the app note link you provided, Unfortuantely when I found the actaul program it wasn't  compatible with PSoC 5.2 or 5.3 designer.

              • 19. Re: Psoc rangefinder
                user_14586677

                The ap note is a PSOC 1 ap note, but being written in C

                   

                should not be too difficult to port. HW portion of the port even

                   

                easier I would think as Creator and its modules tend to be more

                   

                capable.

                   

                 

                   

                Regards, Dana.

                • 20. Re: Psoc rangefinder
                  cathal.ferry

                  OK, so I got the program to port over and it works with PSoC designer 5.3 and ive switched to my cy8c27443 24pxi MCU,

                     

                  Ive been reading through the app notes, this ultrasonic based range finder seems to have a more complex circuit as opposed to the other one writter in ASM

                  1 2 Previous Next