problem with internal oscillator

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

problem with internal oscillator

1,410 Views
Daxx
Contributor I
Hi everybody!
 
I have a problem with the internal oscilator, I've tried to change the value of the bus frecuency using the value of the OSCTRIM register, but nothing happened. Here is some code:
 
 
 MOV   #1,CONFIG1
            MOV   #-1,OSCTRIM
            LDA   #-1
herei:   DBNZA here
 
The delay is for wait establishment of the internal oscillator.
 
am I doing something wrong?
 
do you really think that I can trust in the internal oscillator?
 
I'm using Code Warrior V 5 and a microcontroller of Q family.
 
Labels (1)
0 Kudos
3 Replies

396 Views
bigmac
Specialist III
Hello Daxx,
 
For the QT/QY series, the trim value to be written to the OSCTRIM register will be found at the flash location $FFC0, unless it has been erased (a value of $FF).  You appear to be writing a constant value of $FF (= -1) to the register, which would be an extremity of the adjustment range.  The centre value of the adjustment range is $80.
 
The following code snippet would be more typical of the trim adjustment process, usually done during initialisation, where
TRIMVAL   EQU    $FFC0
 
 
         LDA    TRIMVAL
         CMP    #$FF           ; Test for unprogrammed value
         BNE    ST2            ; Branch if programmed
         LDA    #$80           ; Nominal default trim value
ST2:     STA    OSCTRIM
 
On power-up the MCU will default to the internal oscillator, so there is no need for any stabilization delay.
 
Regards,
Mac
 
0 Kudos

396 Views
Daxx
Contributor I
hi bigmac, thanks for answer to my cuestion.
 
0 Kudos

396 Views
Daxx
Contributor I
Sorry, the "i" in label "herei", does not suppose to be there
0 Kudos