Timing of heartbeat LED is off


Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159

    Default Timing of heartbeat LED is off

    Migrated my test code from a 18F26K22 (max 3Kohm impedance on ADC) to a 16F1937 (max 10K).
    Datasheet: https://ww1.microchip.com/downloads/...ets/41364E.pdf
    32 MHz internal clock is on page 74

    I tried a gazillion permutations of the clock settings but I can't seem to get it to blink ON at 1 second intervals.

    Pause 15 takes about 1 second from ON to ON.

    Code:
    #CONFIG
     __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF 
     __CONFIG _CONFIG2, _WRT_OFF & _VCAPEN_OFF & _PLLEN_ON & _STVREN_OFF & _BORV_LO & _LVP_OFF
    #ENDCONFIG
    DEFINE IRCF = %1110                 ' to enable 8 MHz
    DEFINE SCS = %00                    ' system clock determined by FOSC
    DEFINE OSC 32
    'DEFINE TUN = %000000
    ANSELA = %00000000
    ANSELB = %00000000
    ANSELD = %00000000
    ANSELE = %00000000
    TRISA = %00000000
    TRISB = %00000000
    TRISC = %00000000
    TRISD = %00000000
    TRISE = %00001000   ' E3=MCLR
    LEDblink    var     PORTB.5
        LEDblink = 0
    Mainloop:
        if ledblink = 0 then
            LEDblink = 1
        else
            LEDblink = 0
        endif            
        Pause 15
        goto mainloop
    end
    I bow in humbleness and await the appropriate mockery.
    Last edited by Demon; - 12th August 2024 at 06:14.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Timing out DT's Blinking Led
    By tazntex in forum General
    Replies: 3
    Last Post: - 28th May 2010, 17:41
  2. LED Bargraph chip (guitar LED bling-age) ..do with a PIC?
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 12th July 2009, 23:15
  3. Heartbeat LED
    By ecoli-557 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th March 2009, 14:05
  4. Replies: 3
    Last Post: - 5th December 2008, 15:00
  5. LED timing
    By elen-group in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th June 2008, 10:51

Members who have read this thread : 11

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