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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

9,276 次查看
_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.

标签 (1)
5 回复数

2,044 次查看
_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 项奖励
回复

2,044 次查看
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 项奖励
回复

2,044 次查看
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

2,044 次查看
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 项奖励
回复

2,044 次查看
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");

}

}