Visualize Clockout


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Trying to drive an LED with OSC2 out is probably not going to work, as it's not designed to
    drive LEDs. It's a low-current clock output. You might get by with applying OSC2 out to the
    base of a transistor, but I've never tried it.

    And your multi-meter may not be fast enough to keep up with a 2MHz pulse out on OSC2.

    An LED turned ON/OFF at 2MHz will most likely appear to be dimly lit all the time. 2MHz is
    pretty quick.

    Your comment for TIMER1 prescaler is wrong. You actually have the prescaler set to 1:4,
    and your comment on the value of CCPR1 is wrong too. It should be 4096 VS 4069.

    If you want to see the LEDs blink, you're going to need a lot more time between interrupts.

    Try something like this;
    Code:
    @ DEVICE INTRC_OSC_CLKOUT, LVP_OFF, WDT_OFF, MCLR_OFF, BOD_OFF, CCPMX_ON, PWRT_ON
    
    OSCCON = %00010000 ' 125kHz INTERNAL OSCILLATOR
    ANSEL = %00000000  ' MAKE PortA PINS ALL DIGITAL
    PORTB = 0          ' ALL CLEAR AT POR
    TRISB = %00000000
    
    LED VAR PortB.4
    LED1 VAR PortB.3
    
    T1CON = %00110001   ' ENABLE TIMER1, PRESCALE 1:8, INTERNAL CLK
    PIE1 = %00000100    ' ENABLE CCP1 INT
    CCP1CON = %00001011 ' COMPARE MODE, AUTO RESET TIMER1
    CCPR1L = %00000000  ' SET CCP REGISTER TO 4096 
    CCPR1H = %00010000  ' 4096*8*32uS = 1.048 seconds toggle rate
    INTCON = %11000000  ' ENABLE GLOBAL INT, ENABLE PERIPHERAL INT.
    
    on interrupt goto ISP
    
    Main:
        @ nop
        GOTO Main
    
    DISABLE
    ISP:
        TOGGLE LED
        TOGGLE LED1
        PIR1.2 = 0
        RESUME
        ENABLE
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Aug 2006
    Location
    brooklyn
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    bruce, thanks for the reply,

    i may try to put an NPN on OSC2 to see what's up. but i'm more interested in controlling the PWM driver.

    i have the PIC connected to the TLC PWM driver, and it's not working. although it looks like there may be a faint glimmer of life on startup. the thing that gets the PWM going is the GSCLK which i'm attempting to drive with my clockout.
    the DS for the TLC says that minimum pulse time for GSCLK is 16ns. i'm way in range there...

    will try to slow everything down to make sure my timing is matching what the driver needs.
    also thinking about using TMR0 interrupt at 1:16 and toggling my output in the ISR.

    by the way, the pins on the TLC i'm concerned about are
    GSCLK greyscale clock which the chip uses to time the PWM
    BLANK which is toggled at the end/beginning of each 4096 clock period

    i hope the CCP1 can work, cause it's so cool.
    anybody else use this type of LED controller?

Similar Threads

  1. visualize clockout
    By JoelMurphy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th December 2008, 02:09
  2. Replies: 4
    Last Post: - 26th September 2008, 00:50

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