QT1 oscillator problem

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

QT1 oscillator problem

1,595 Views
dongustavo
Contributor I
Hello,
I want to make a QT1 work with an external crystal, but it doesn´t work.
Here is my Init code:
//----------------------------------------------------------------------
// Función: InitHard()
// Descripción: inicializa los ports y registros CONFIG
//----------------------------------------------------------------------
void InitHard(void){
unsigned int i;
       CONFIG1=0b00111001;
            
       DDRA=0b00000011;
       CONFIG2=0b00011000;
       i=0xffff;
       while(i!=0) {i--;} //delay
       asm bset 1,OSCSTAT
       i=0xff;
       while(i!=0) {i--;} //delay

      asm{
       XXX: brclr 0,OSCSTAT,XXX 
     }
   
       INTSCR=0b00000010;     //falling /des habilitada  
 return;

It stops on XXX: brclr 0,OSCSTAT,XXX.
The oscillator it´s not working, I cheked that with an oscilloscope.
 
What could be the problem?
Does anyone have a code example?
 
Thank you,
gustavo. 
Labels (1)
0 Kudos
3 Replies

478 Views
tonyp
Senior Contributor II
Assuming the fault is not in the hardware part of your design, the code seems OK for QT1.  It will not work for QT1A, though.  (I've been bitten by this myself when I received A suffixed parts instead of the ordered non-A ones.)

And since I now have a mixed batch of chips, I came up with the following little routine to dynamically check which version I'm running so I can handle the few differences between theses two versions without burning different firmware to each.  This works well, but I don't claim it's the best method to check hardware type.

Hope this helps.


;*****************************************************************************
; Purpose: Return True of False for older MCU (QTx) instead of newer (QTxA)
; Input  : None
; Output : Carry Clear = Yes
;        : Carry Set   = No

IsItOldMCU          psha
                    lda       ADICLK              ;get original register value
                    bset      ADLSMP.,ADICLK
                    brset     ADLSMP.,ADICLK,?IsItOldMCU.Exit ;set Carry accordingly
?IsItOldMCU.Exit    sta       ADICLK              ;restore original register value
                    pula
                    rts



Message Edited by tonyp on 2007-10-17 07:23 PM
0 Kudos

478 Views
bigmac
Specialist III
Hello,
 
Another potential method of checking for A-suffix device, or otherwise - after POR read the OSCSC register for QTxA, or OSCSTAT register for QTx device (different names but same location).  For the QTxA device the value should be 0x20, but 0x00 for the QTx device.
 
Regards,
Mac
 
0 Kudos

478 Views
dongustavo
Contributor I
oh yes: I ordered QT1 and they sent me QT1A... there are 2 new registers for this device.
I have not modified the code yet, but I´m sure that´s the problem.
Thanks
0 Kudos