delay

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

cross mob
Anonymous
Not applicable

I use PSoC Designer 5.1

   

CY8C29466 devide

   

How to do a dealy in language C ? Could I use some library ?

0 Likes
12 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

In the LCD-Module-library are some delay-functions for PSoC1. When using an LCD-Module you can search for "delay" to get hands on them.

   

 

   

By the way: I recommend you to update to designer 5.2, there are some improvements.

   

 

   

Happy coding

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Keep in mind PSOC 1 internal clock is not highly accurate, so if you

   

need precise delays, an external Xtal or precision clock is necessary.

   

 

   

http://www.cypress.com/?rID=2773

   

 

   

http://www.cypress.com/?docID=35967

   

 

   

http://www.cypress.com/?docID=34285

   

 

   

Regards, Dana.

0 Likes
ArvindK_86
Employee
Employee
10 sign-ins 5 sign-ins 10 solutions authored

Yes, you can use this library - http://www.cypress.com/?id=4&rID=47960

   

 

   

You will find two files delay.h and delay.c which you can include in your project.

   

 

   

Afterwwards, just call the function to insert a delay in execution. The functions are CPU speed independant.

0 Likes
Anonymous
Not applicable

if you don't want high accuracy.

   

you can use CyDelay()  and CyDelayUs() which should be in CyLib.

   

CyDelay(X) is for Xms, X is unsigned long

   

CyDelayUs(X) is for Xus, X is unsigned int

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

In the earlier post -

   

 

   

Yes, you can use this library - http://www.cypress.com/?id=4&rID=47960

   

 

   

You will find two files delay.h and delay.c which you can include in your project.

   

 

   

Afterwwards, just call the function to insert a delay in execution. The functions are CPU speed independant.

   

 

   

These functions are corrected for the clock selected, but not the clock accuracy itself.

   

Eg they are corrected if you pick a 6, 12, 24 Mhz clock, but not the accuracy of that

   

clock. Only a xtal derived clock will give you precision delays.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Which header file should I include to invoke CyDelay and CyDelayUs functions.

   

Thanks and Regards

   

Srinivas

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

CyDelay() and CyDelayUs() are to be found in the PSoC 3, 4 and 5 world, not in PSoC1. When using a PSoC1 and Designer  follow the hints in this thread, when using a PSoC3/4/5 and Creator you do not need to include any extra file.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Yes you are right I'm using PSoc designer. I did include delay.asm and delay.h in my project and its working fine.

   

However I need 1us delay also, is there any library functions ?

   

Thanks & Regards,

   

Srinivas

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You will have to use a timer, counter, or one shot module.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thanks for the reply.

   

I used NOP instruction inorder to achieve the small delay required and it was also clock independent.

   

asm("NOP");

   

Regards,

   

Srinivas

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

NOPs are not clock independent, they rely on the execution speed of the processor which is defineable with the clock speed.

   

For some more general functions have a look here: www.cypress.com/

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Delay accuracy will be +/- 2.5%, see datasheet -

   

 

   

0 Likes