3 Replies Latest reply on Mar 8, 2016 1:34 AM by userc_40401

    Psoc 5LP Custom Function return error




      We are currently working on a project that is creating a small autonomous vehicle. We are having trouble executing multiple functions that we have written. We are able to execute one full forward function but never return to our main to run the reverse function. Upon debugging we found that we get stuck in a while loop located in Cm3start.c file.  Any ideas/suggestions as to why we are never returning to our main code after completing one movement function?  All help is greatly appreciated.  The File for our project is attached.


      Thank you,



        • 1. Re: Psoc 5LP Custom Function return error

          I think there's a fault in one of your move functions.. The quadrature decoders generate positive or negative values depending on which direction your motors have spun. This means that one or the other of the while loops will never end in user_movement_functions.c (EDIT: or to be more accurate, it won't end the way you expect it to).


          The other thing that strikes me is that there is no endless loop in your main() function. When your code finishes executing, main() returns, and you will wind up in Cm3Start.c at lines 387-390 in the following code:


          while (1)
              /* If main returns, make sure we don't return. */


          I'd suggest putting the following part of your main() function in an endless loop like so:







          • 2. Re: Psoc 5LP Custom Function return error

            Thank you PolyVinalDistillat. That fixed our problem. For the Negitive values of the reverse function we are going to edit the code to take that absolute value of the encoder reading.

            • 3. Re: Psoc 5LP Custom Function return error

              Glad to have helped :)