time issue

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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

   

     san2884

0 Likes
4 Replies
Anonymous
Not applicable

Nice to hear that , we are waiting 🙂

0 Likes
Anonymous
Not applicable

Hi,

   

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
  2.     
  3. Toggle the same digital pin immedaitely after the execution of this API
  4.     
  5. Capture the above two events on an oscilloscope and determine the time 
  6.    
   

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 

   

-Uday

0 Likes
Anonymous
Not applicable

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,

   

san2884

0 Likes
Anonymous
Not applicable

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".

0 Likes