Problem selecting external crystal as clock source

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

Problem selecting external crystal as clock source

2,015件の閲覧回数
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 返信

262件の閲覧回数
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 件の賞賛