Wrong Frequency


Results 1 to 6 of 6

Thread: Wrong Frequency

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Hmmm , I thought the DEFINE OSC x takes care of the frequency registers. I'm just curious, will it work if the internal oscillator is defined first and then the frequency is defined after that? In the next code, I just swapped the order of the first two lines in gadelhas original code.

    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF & _BOD_OFF
    
    Define OSC 8
      
    '                                PINOUT 1 = IN; 0 = OUT
    ' ====================================================================
                  '76543210
     TRISIO     = %00000001
     
                  '76543210
       GPIO     = %00000000
       
     ANSEL = 1  'GP0 ANALOG             
     VRCON = 0  'VREF OFF
     CMCON0 = 7 'COMPARATOR OFF             
     ADCON0 = %10000000  'RIGHT JUSTIFY - 128
     
     PR2     = %00011000 'SET 24 - 5000Hz - 8Bits
     T2CON   = %00000110 'TIMER2 ON - PRESCALER 1:16 - Max Duty Value 100 - 1% Step
     CCPR1L  = %00000000
     CCP1CON = %00001100 'PWM ON
    Robert
    Last edited by rsocor01; - 5th December 2010 at 03:37.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

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