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

PSoC™ 5, 3 & 1

Switten
Level 2
25 sign-ins 10 likes given 10 sign-ins
Level 2

Hello,


For a project I am trying to make, I need to know the elapsed time between each cycle(so that i can subtract these) . I know that in arduino you can use the millies() functionfor , but I didn't find anything like that in the creator. I am aware of the exsistence Odissey's implementation using a stopwatch, but I wonder if there is a easier way to do this.


thanks for replying

0 Likes
1 Solution
6 Replies
Raj_JC
Moderator
Moderator 50 solutions authored 10 likes given 100 replies posted
Moderator

Hi @Switten,

You can refer to the thread 'Measuring time interval using SysTick (CY8CKIT-059/CY8CKIT-044)' by MotooTanaka. 

Let me know if you need further help with this.

 

Thank you

Best Regards

Raj Chaudhari

Switten
Level 2
25 sign-ins 10 likes given 10 sign-ins
Level 2

Thank you verry much @Raj_JC 

But wanted to know was the duration of 1 cycle when running the code without any external HW involved. The reason for this is because I am reading the data from an MPU 6050 and I want to know to current angle the device is positioned in.

I used  Sam's blog  as reference for my code but he never completed it. And because I am still a beginner when it comes to programming I am not capable to adjust the program you suggested to run without the input button.

But thx for replying

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Switten,

Raj's suggestion of using the systick resources in the PSoC is very simple and requires NO external components.

Odissey1's stopwatch, example uses internal PSoC timers to provide even more accuracy.  Again no external components to be added.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Switten
Level 2
25 sign-ins 10 likes given 10 sign-ins
Level 2

I think there was a misunderstanding. What it meant by external components was the button (on pin 2.2) that starts/clears the interupt.

It it possible to do this without the need of the button input? (so that I can compare the elapsed time between the data read from the mpu6050)

0 Likes
Switten
Level 2
25 sign-ins 10 likes given 10 sign-ins
Level 2

@MotooTanaka at first glance it looks like this is what I needed.

Thank you very much for your help and for replying  😆😊