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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

9,275件の閲覧回数
_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,043件の閲覧回数
_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,043件の閲覧回数
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,043件の閲覧回数
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,043件の閲覧回数
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,043件の閲覧回数
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");

}

}