cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

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
Reply
12 Replies
JoMe_264151
Expert II

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
Reply
ETRO_SSN583
Esteemed Contributor

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
Reply
ArvindK_86
Employee

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
Reply
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
Reply
ETRO_SSN583
Esteemed Contributor

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
Reply
Anonymous
Not applicable

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

   

Thanks and Regards

   

Srinivas

0 Likes
Reply
JoMe_264151
Expert II

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
Reply
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
Reply
ETRO_SSN583
Esteemed Contributor

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

   

 

   

Regards, Dana.

0 Likes
Reply
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
Reply
JoMe_264151
Expert II

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
Reply
ETRO_SSN583
Esteemed Contributor

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

   

 

   

0 Likes
Reply