4 Replies Latest reply on Mar 28, 2011 1:35 PM by userc_42603

    time issue

      hi all,


              I'm new to PSoC Family. I want to know how to calculate the time consumed by the function (like simulation in other controller). As i'm using API for adc conversion i'm not able to check how much time it will take to execute the API.


             At the same time i'm trying to drive the LED through port pin p5[0].In the schematic i made pin as digital output.


               And pin drive mode i kept strong drive. And in the code i written


                                                   drive_state = (drive_state & 0x02);
                                                    UT_Cont_ON_OFF_Write(drive_state);       // Turn pin 2 of port to turn  LED ON;                                


            Where UT_Cont_ON_OFF_Write is pin name and drive_state is the variable with initial value =0xFF; 


           Please suggest me about above problem


           With regards



        • 1. Re: time issue

          Nice to hear that , we are waiting :)

          • 2. Re: time issue



            Please ignore hte previous comment :)


            An easy and quick way to estimate the time taken to execute an API is to,

            1. Make a digital pin Go low/high just before the start of execution of this API
            3. Toggle the same digital pin immedaitely after the execution of this API
            5. Capture the above two events on an oscilloscope and determine the time 

            And to drive an LED on a port Pin, set the Port pin to Strong Drive mode. Map the pin on the Topdesign to an approproate pin in the project.cydwr window. In your case it is P5[0]. And to set the state of the Pin use the API Pin_Write(), where Pin is the name of the pin instance on your topdesign. This information is available in the Pin component datsheet. All the API associated with any PSoC3/5 component is listed and explained in the component datasheet. You dont need to do all the register writes manualy like a conventional microcontroller.


            Also you might want to read through this Application to get started with PSoC3. 


            AN54181 - PSoC® 3 - Getting started with a PSoC 3 design project 



            • 3. Re: time issue

              Hi uday,


                            Thanks for your suggestion.Actually the method you mentioned (toggling the port pin to calculate the time) is looking like old method (using CRO).Looking for any advanced method. Suggest me if any other method to calculate the time.


              With regards,



              • 4. Re: time issue

                This is similar to the other recomendation, but instead of toggling an I/O instead start a timer (or counter or equivalent) when you enter and stop the timer when you leave and then later read the value. I've done this with other devices, but not specifically the PSOC.


                By using multiple timers, incuding one that times the entire process, you can also get statics on what percentage of time is spent in various tasks. The component we used (non PSOC) was designed for timing so it also counted the number of "starts".