3 Replies Latest reply on Nov 21, 2016 11:13 AM by user_1377889

    why cydelay is not working properly(psoc3)

    prabhu05fe_1711731

      Hello Everyone, 

         

      I hav configured two gpio pins from Psoc3 one for Reset and another for Power On likewise in the below attached i wrote my simple main inorder to reset the logic actually my device will turn on only if the Reset pin held low for few seconds and then go back to high so inorder to achieve this logic i have intially set the high for RESET pin and then it will be high for few seconds then it should go (RESET pin) to logic low for 2 seconds after that it should go again logic high 

         

       

         

      so finally which brings hte logic of reset the device and it will restart again but my problem is above logic is not working as expected coudl anyone please suggest me what mistake did i made in the below code or please suggest me some alternative ways to implement the logic in PSOC3

         

       

         

      int main()
      {
         
          Switch_int_Start();
          isr_100ms_Start();    
          CyGlobalIntEnable;    
      RESET_Write(1);
      PWR_ON_Write(0);
              Enable_3V8_Write(0);
          
      CyDelay(5000);
      RESET_Write(0);
      CyDelay(2000);
      RESET_Write(1);
      }

         

      Any help would be greatly aprreciated

         

      Thank you

         

      prabhu

        • 1. Re: why cydelay is not working properly(psoc3)
          user_1377889

          The infinite loop is missing that repeats the core of your project. Instead you return from main which will initialize the project over and over again. Next time please post your complete project, so that we all can have a look at all of your settings. To do so, use
          Creator->File->Create Workspace Bundle (minimal)
          and attach the resulting file.

             

           

             

          Bob

          • 2. Re: why cydelay is not working properly(psoc3)
            prabhu05fe_1711731

            Hello BOb

               

             

               

            Thank you for your kind please  have a look into my attached project and help me out why my reset pin logic is not behaving properly as expected i am not able to find the problem please suggest me with my program

               

            waiting for your reply

               

            Thank you

               

            prabhu

            • 3. Re: why cydelay is not working properly(psoc3)
              user_1377889

              Revise your interrupt handlers. Have a look into the "System Reference Guide" (from Creeator -> Help) concerning CY_ISR snd CY_ISR_PROTO. Additionally use the StartEx() API for your interrupts, This prevents loss of code in the case when the generated files get corrupted, you can now put the interrupt handlers into your own code.

                 

              PSoC3 is a bit old-fashioned and so there is a warning you get. Reduce the code to just set a flag (declared as volatile uint8) in your main() check for the flag, when set act accordingly and reset the flag again.

                 

              Again: your program runs 7 seconds until it reaches the line

                 

                  GSM_RESET_Write(1);

                 


              and then? main() ends here and the program returns. Returns to where??? Like a hardware reset the PSoC gets initialized anew and starts over. Every PSoC example (have a look at some) has got an infinite loop usually written as for(;;) where in between the job is performed.

                 

               

                 

              Bob