M52233 functions

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,131件の閲覧回数
anthonyrios
Contributor I

I am working with the M52233 Demo board and was wondering if there is a simple nono_sleep() function or some sort of delay function already implemented to be used with the Freescale CodeWarrior IDE and this board.  Or should i make my own?

ラベル(1)
1 解決策
1,030件の閲覧回数
scifi
Senior Contributor I

DMA timers are perfect for sub-microsecond delays. They can be configured as 32-bit naturally overflowing timers running at CPU frequency:

#include "mcf522regs.h"

#define DTIM_NUM 1

void

timer_init(void)

{

        DTIM_DTMR(DTIM_NUM) = DTMR_CLK_DIV1 | DTMR_RST;

}

void

timer_delay(unsigned int ticks)

{

        unsigned int start, diff;

        start = DTIM_DTCN(DTIM_NUM);

        do

        {

                diff = DTIM_DTCN(DTIM_NUM) - start;

        }

        while (diff <= ticks);

}

元の投稿で解決策を見る

2 返答(返信)
1,030件の閲覧回数
Monica
Senior Contributor III

Anthony, was this of any help?

Please keep us posted!

Best regards!

0 件の賞賛
返信
1,031件の閲覧回数
scifi
Senior Contributor I

DMA timers are perfect for sub-microsecond delays. They can be configured as 32-bit naturally overflowing timers running at CPU frequency:

#include "mcf522regs.h"

#define DTIM_NUM 1

void

timer_init(void)

{

        DTIM_DTMR(DTIM_NUM) = DTMR_CLK_DIV1 | DTMR_RST;

}

void

timer_delay(unsigned int ticks)

{

        unsigned int start, diff;

        start = DTIM_DTCN(DTIM_NUM);

        do

        {

                diff = DTIM_DTCN(DTIM_NUM) - start;

        }

        while (diff <= ticks);

}