这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » [求助]帮忙看看这两段代码有什么不同,搞了我两晚上的时间了,郁闷.

共2条 1/1 1 跳转至

[求助]帮忙看看这两段代码有什么不同,搞了我两晚上的时间了,郁闷.

菜鸟
2007-01-22 06:09:52     打赏

帮忙看看这两段代码有什么不同,搞了我两晚上的时间了,郁闷.

/* Set system clock.*/

/*set PLLA for 180MHz */
LDR r1, =AT91_CKGR_PLLAR
LDR r2, =PLLAR_VAL
STR r2, [r1]

LDR r1, =AT91RM9200_DELAY_VALUE
LockPLLA:
SUBS r1, r1, #1
BNE LockPLLA


/* set PLLB for USB 48MHz */

LDR r1, =AT91_CKGR_PLLBR
LDR r2, =PLLBR_VAL
STR r2, [r1]

LDR r1, =AT91RM9200_DELAY_VALUE
LockPLLB:
SUBS r1, r1, #1
BNE LockPLLB

/* Write in the MCKR dirty value concerning the clock selection CSS then overwrite it in a second sequence */
LDR r1, =AT91_PMC_MCKR
LDR r2, =AT91_PMC_CSS_SLOW_CLK
STR r2, [r1]

LDR r1, =AT91RM9200_DELAY_VALUE
MCKRDY1:
SUBS r1, r1, #1
BNE MCKRDY1

/* set new MCKR value for you chooose */
LDR r1, =AT91_PMC_MCKR
LDR r2, =AT91_PMC_NEW_CLK
STR r2, [r1]

LDR r1, =AT91RM9200_DELAY_VALUE
MCKRDY2:
SUBS r1, r1, #1
BNE MCKRDY2


下面是C语言的

int i=0;
volatile int *pReigster = '\0';

pReigster = AT91_CKGR_PLLAR;
*pReigster = PLLAR_VAL;
for (i=0; i<AT91RM9200_DELAY_VALUE; i++);

pReigster = AT91_CKGR_PLLBR;
*pReigster = PLLBR_VAL;
for (i=0; i<AT91RM9200_DELAY_VALUE; i++);


pReigster = AT91_PMC_MCKR;
*pReigster = AT91_PMC_CSS_SLOW_CLK;
for (i=0; i<AT91RM9200_DELAY_VALUE; i++);


pReigster = AT91_PMC_MCKR;
*pReigster = AT91_PMC_NEW_CLK;
for (i=0; i<AT91RM9200_DELAY_VALUE; i++);

[align=right][color=#000066][此贴子已经被作者于2007-1-21 22:14:07编辑过][/color][/align]



关键词: 求助     帮忙     看这     两段     代码     什么     不同     搞了         

菜鸟
2007-01-26 19:08:00     打赏
2楼
帮你顶一下

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]