9S08QG8 internal clock accuracy

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

9S08QG8 internal clock accuracy

2,811件の閲覧回数
stevec
Contributor III
I'm a new user to this chip and want to use it's serial USART for communicating with an external device. I wish to use the internal oscillator as a clock source so that I can use the external clock pins for I/O. I have found that the stability of the internal clock is 2% which should be adequate for serial comms at 19200 baud. What steps do I have to go through to ensure that the internal clock is set correctly. I must admit to being confused by the trim thing. I have always used an external crystal for previous designs but need a couple of extra pins. Does the default internal clock get set to 32kHz? or is this frequency dependant on the trim register?
ラベル(1)
0 件の賞賛
返信
4 返答(返信)

927件の閲覧回数
stevec
Contributor III
Thanks Peg,
Does this mean that the trim value will need setting for every device programmed?
0 件の賞賛
返信

927件の閲覧回数
Encoder
Contributor I
Hi Stevec.
 
With proper settings, CodeWarrior will detect correct clock trim variable for the actual cpu and will write it into a default location in flash when you'll upload your program in flash.
 
Just copy this variable in the right register at the beginning of your code and the clock will be precisely set. On 9S08AW60 I achieve nearly 0.5% precision at ambient temperature this way. For this uC the first 2 line of ASM code in my program are:
 

lda OSCTRMDEFAULT  ; load CW detected trimmer variable from default location

sta OSCTRM                ; Preset oscillator trim factor, writing the clock trimmer register

 
I think that this may be the same for 9S08QG8 (see your default 9S08QG8.inc and the data sheet for the variable names and locations)
 
Bye,
Encoder
 
0 件の賞賛
返信

927件の閲覧回数
stevec
Contributor III
That's good news. I should have my demo kit tomorrow so will get to grips with it over the next few days. An active forum certainly has to be a big factor in choice of processor nowadays. These things didn't exist when I started with microprocessors nearly 30 years ago. Thanks all
0 件の賞賛
返信

927件の閲覧回数
peg
Senior Contributor IV
Hi stevec,
 
The internal clock is nominally 32.7kHz. But from device to device it varies over quite a wide range. The 9 binary weighted trim bits are there to fiddle this frequency so it is as close as possible to the intended frequency. This is perfectly adequate for baudrate generation even without the fine (9th) bit. Programmer software either from P&E or within Codewarrior etc will usually tell you the necessary trim value which you programme into $FFAE:FFAF then copy down to $003B:003A on initialisation.
 
0 件の賞賛
返信