Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
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.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;
An easy and quick way to estimate the time taken to execute an API is to,
Make a digital pin Go low/high just before the start of execution of this API
Toggle the same digital pin immedaitely after the execution of this API
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. 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.
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.
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".