Oscillator question and measurement


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425

    Default Oscillator question and measurement

    I only had a PIC in a QFN package but wanted to make a protoype with it. What I did was strip a 24 gauge wire and solder each individual strand to each pin. I'm never doing that again but.....

    It seems slower than what it should be. I want to determine if it's the hardware or software so I used this:
    Code:
    Start:
    TOGGLE portd.1
    PAUSEUS 1
    GOTO start
    I have a 20 MHz crystal and DEFINE OSC 48. When I measure the frequency, am I supposed to get 1MHz? I get about 374 KHz. One thing that may be causing this is, to stabilize the soldering, I put hot glue on all of the pins not realizing that it's probably putting a little resistance between the oscillator pins.

    Any ideas?

  2. #2
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    Hi,

    Get rid of the line "PAUSEUS 1" and tell us what happens.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    some JELT pcb " Tropicoat " protective varnish makes real good glue ... did you also try nail lacquer ??? ( NO metallic colour !!! - of course -)

    a simulator run would show your program NEVER will run @ 1 Mhz ... as TOGGLE and GOTO commands need some time to execute

    we also must suppose your Pic is a 18F series for the Pauseus1 to be equal to 1µs ...

    Now, Hot glue doesn't disturb the oscillator in any way ...

    Alain
    Last edited by Acetronics2; - 24th February 2013 at 21:16.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    Get rid of the line "PAUSEUS 1" and tell us what happens.
    I didn't have a scope handy and the meter I had isn't able to calculate high frequencies. I'll be able to try that tonight. What should I expect to see with just a toggle command?

    we also must suppose your Pic is a 18F series for the Pauseus1 to be equal to 1µs ...
    Yes, it's an 18F4550. The program works but the CAN data isn't flowing smoothly compared to the previous devices I made. All of the pinouts are different, and wanted to rule that out, but I can't even see how that would cause slow CAN data in the first place.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    a little MPSIM ( MPLAB ) simulation - supposed to be relatively true - gives à 3.2µs half -cycle to your test ... around 160 khz output frequency !
    BTW ... I'm not sure the DEFINE OSC 48 and a 20 Mhz Xtal to be a good combination ...

    best result @ 1.8µs half cycle given by
    Code:
    Portb.1 = ! Portb.1
    instead of TOGGLE + PAUSEUS1
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    Here are the results. Are these typical?

    Code:
    start:
    pauseus 1
    toggle portd.1
    goto start
    375 KHz

    Code:
    start:
    toggle portd.1
    goto start
    1 MHz

    Code:
    start:
    Portb.1 = ! Portb.1
    goto start
    This does nothing

    Code:
    start:
    portd.1=1
    portd.1=0
    goto start
    3 MHz

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    Quote Originally Posted by Christopher4187 View Post
    Code:
    start:
    Portb.1 = ! Portb.1
    goto start
    This does nothing
    Sure it does not show anything on portD1 ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  8. #8
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    I know. I was too lazy to edit it yesterday. My original comment still stands.

  9. #9
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    ohhh ... may be the RMW issue ...

    due to a 18F chip ... I should have written:

    Code:
    start:
    latb.1 = ! latb.1
    goto start
    on test with the EP5 tomorrow morning ...
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  10. #10
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    Quote Originally Posted by Christopher4187 View Post
    I didn't have a scope handy and the meter I had isn't able to calculate high frequencies. I'll be able to try that tonight. What should I expect to see with just a toggle command?
    I think the problem is that you are not configuring the fuses of the PIC correctly. Are you also setting the OSCON register? I use a 4MHz crystal with my 18F4550 and to make it work the first time it was a pain.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  11. #11
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    Results of the test ...

    output freq is exactly that expected ... and that MPSIM shows ....

    111.1 Khz with a 8 Mhz Xtal
    277.7 Khz with a 20 Mhz Xtal

    sooo ... getting 1 Mhz output looks a bit too much !!! - gives 72 Mhz @ Clock - 18Mhz Xtal and PLL x 4 ; that looks real hard overclocking for such chips ...
    MAY BE POSSIBLE, but with very light loads on the output ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  12. #12
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: Oscillator question and measurement

    Results of the test ...

    output freq is exactly that expected ... and that MPSIM shows ....

    111.1 Khz with a 8 Mhz Xtal
    277.7 Khz with a 20 Mhz Xtal
    666.5 Khz with 48 Mz @ Clock
    833.1 Khz with ... 60Mhz ( poor USB clock ! )
    looks a bit over 1Mhz with ... 80Mhz ( poor ... etc )

    Code:
    #CONFIG
    
        __CONFIG    _CONFIG1L, _PLLDIV_3_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L  
                                ;              ;                      ; USB clock source comes from the 96 MHz PLL divided by 2
                                ;              ; [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
                                ; 1/2 prescale 
    
    
        __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H 
                                ;                  ;               ; Oscillator Switchover mode disabled
                                ;                  ; Fail-Safe Clock Monitor disabled
                                ; HS oscillator, PLL enabled, HS used by USB
        __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L  & _BORV_2_2L  & _VREGEN_ON_2L   
        __CONFIG    _CONFIG2H, _WDT_OFF_2H 
        __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H 
        __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L  & _XINST_OFF_4L & _DEBUG_OFF_4L
          
        __CONFIG    _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
        __CONFIG    _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
        __CONFIG    _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L 
        __CONFIG    _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H 
        __CONFIG    _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L &_EBTR2_OFF_7L &_EBTR3_OFF_7L 
        __CONFIG    _CONFIG7H, _EBTRB_OFF_7H    
    
             
    #ENDCONFIG
    
    trisa = 0
    trisb = 0
    trisc = 0
    trisd = 0
    lata = 0
    latb = 0
    latc = 0
    latd = 0
    
    Start:
    Latb.1 = ! Latb.1
    GOTO start
    END
    some surely will throw me everything that can fly .... LOL !

    sooo ... getting 1 Mhz output looks a bit too much though !!! - gives 72 Mhz @ Clock - 18Mhz Xtal and PLL x 4 ; that looks real hard overclocking for such chips ...
    MAY BE POSSIBLE, but with very light loads on the output ...

    I did it ... so any idiot can do it too ...

    the 4550 did not die ... really nice chip, isn't it ???

    Alain

    PS: this "timeout" really is a shame, Lester ....
    Last edited by Acetronics2; - 26th February 2013 at 15:26.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. High Speed Oscillator question
    By Tina10 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th July 2012, 10:29
  2. A question on defining the external oscillator
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2009, 14:31
  3. Using PIC16F88 oscillator as oscillator for other ICs
    By Torael_7 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 30th March 2008, 12:58
  4. AC Measurement
    By Atom058 in forum General
    Replies: 18
    Last Post: - 14th December 2006, 20:20
  5. low Resistance measurement
    By sanatana in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th October 2004, 18:32

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts