This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help with external crystal...

Hi guys. I changed my board to C8051F226 already and i'm using a 32.768kHz external crystal. I have read the datasheet for the oscillator. But i do not understand this sentence, can someone please explain it to me?

"Crystal Oscillator Mode with divide by 2 stage."

The datasheet also recommend me to do the following:

1.Enable the external oscillator
2.Wait 1 ms
3.Poll for XTLVLD '0' ==> '1'
4.Switch to the external oscillator

I have done the 1st 2 steps, but i can't seem to poll for XTLVLD. When i compile, it says undefined symbol.

Parents
  •  MOV R1,OSCXCN
    WAIT1:CJNE R1,#80H,WAIT1
    

    Isit advisable to use the above code?

    I can run using the above code. But whenever i run, it will hang at the 1st line when it runs to the oscillator config routine.

    This is my oscillator routine.

    MOV OSCICN,#08H ; Disable internal oscillator &  enable external oscillator
    ACALL DELAY
    MOV R1,OSCXCN
    WAIT1:CJNE R1,#80H,WAIT1 ; poll to see whether crystal is ready
    MOV OSCXCN,#32H         ; config external crystal
    

    Does it have something to do with my crystal or my programming?

Reply
  •  MOV R1,OSCXCN
    WAIT1:CJNE R1,#80H,WAIT1
    

    Isit advisable to use the above code?

    I can run using the above code. But whenever i run, it will hang at the 1st line when it runs to the oscillator config routine.

    This is my oscillator routine.

    MOV OSCICN,#08H ; Disable internal oscillator &  enable external oscillator
    ACALL DELAY
    MOV R1,OSCXCN
    WAIT1:CJNE R1,#80H,WAIT1 ; poll to see whether crystal is ready
    MOV OSCXCN,#32H         ; config external crystal
    

    Does it have something to do with my crystal or my programming?

Children