Problem selecting external crystal as clock source

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

Problem selecting external crystal as clock source

2,362 次查看
pallavaggarwal
Contributor I
hi,
I want to run my controller QB8 using external crystal 4.9152MHz
and not using internal
i have used the following code as atest but after removing thr crystal also i get the pulses on PTB0 .
 
please check my code and guide me how to use the external cystal as clock
source
 
this program just makes on/off PTB0
 
#include <hidef.h> /* for EnableInterrupts macro */
#include <MC68HC908QB8.h> /* include peripheral declarations */

//macro defination for BIT wise manupulation
#define setbit(A,B) A|=(1<<B)
#define clrbit(A,B) A&=~(1<<B)

void main(void)
{

unsigned char a=0,i=0;
OSCSC=0xC4;
CONFIG1=0x01;//Disable COP
DDRA=0x10;
DDRB=0xFF;
while(1)
{
PTB=0x01;
for(i=0;i<100;i++);
PTB=0x00;
for(i=0;i<100;i++);
}
}
 
标签 (1)
0 项奖励
回复
1 回复

609 次查看
peg
Senior Contributor IV

Hi pallav,

It appears to me that you should write 0xC4 to OSCSC.

Then wait about 1ms to stabilise.

Then set ECGON in OSCSC.

Then shortly after you should be running on ext xtal.

Refer to 11.3.2.2 of QB8 datasheet.

Regards David

 

0 项奖励
回复