How to making a program delay with KDS (processor expert)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to making a program delay with KDS (processor expert)

8,845 Views
_daniel_
Contributor II

Hello, Please. There is a 100us delay function in Kinetis Design Studio? (With ProcessorExpert) I have not found. Function: "Cpu_Delay100us()", as it was in the CodeWarrior? Thank's.

Labels (1)
5 Replies

1,613 Views
_daniel_
Contributor II

Hello everyone;

Xiangjun did not know how to create this delay, because I did not know this syntax. With your help, I can test in practice with oscilloscope and set the appropriate value of the constant (uC with internal oscillator).

Alice and Erich, had imported the component of the CodeWarrior, downloaded in MCUoneclipse, but did not work, now with this new update solved the problem, as you can see in the attached image.

Thank you for the help of all of you.

Was developing a routine (library ".c" and ".h") for serial communication using a pin any of a micro, will be used in CodeWarrior. But took the opportunity to test the KDS. Further, plan to use these Kinetis and KDS IDE.

Erich, your site is very interesting, all information I found there to this day, have always been very helpful.

solved_dly.jpg

0 Kudos

1,613 Views
BlackNight
NXP Employee
NXP Employee

Hi Daniel,

yes, for the actual gcc/GNU compiler settings it is necessary to use __asm() in KDS (before it was ok just to use asm()).

So it looks you had some older components.

Glad to hear that things are resolved :-).

But keep in mind that the WAIT delay is about +/- 10% accurate, depending on your interrupt load. If you need more precision, use a timer interrupt instead.

Erich

0 Kudos

1,613 Views
BlackNight
NXP Employee
NXP Employee

Hello,

There is a WAIT Processor Expert component available which implements busy waiting in a loop:

pastedImage_0.png

That component is available in a set of other components on SourceForge (McuOnEclipse - Browse /PEx Components at SourceForge.net), see McuOnEclipse Releases on SourceForge | MCU on Eclipse

I hope this helps,

Erich

1,613 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Daniel,

Do you sue the KSDK PE or only PE ?

If use the KSDK PE, this the function  "void OSA_TimeDelay(uint32_t delay);" under the "fsl_os_abstraction "component .

While if use only PE , it seems not , while i searched this :No more delay component for CPU?  It is about install "wait " component to CW ,

while the KDS is the lite of CW , so you can try .

Hope it helps

Alice

0 Kudos

1,613 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Daniel,

In general, we use the the following code to delay the mcu. I do not think we have the other methods to delay the MCU.

BR

XiangJun Rong

#define N 1000

void Cpu_Delay100us(void)

{

uint16_t i;

for(i=0; i<N; i++)

{

__asm("nop");  //in CW tools use asm("nop");

}

}