Can't blink a led wih 16F1519
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2013
    Posts
    495

    Default Can't blink a led wih 16F1519

    The code is as follows:

    Code:
    include "modedefs.bas"
    OSCCON = %01111010  'SET INTOSC TO 16MHZ
    TRISC=%0000000 'set PORTC as output all
    DEFINE OSC 16
    SACKISI:
    HIGH PORTC.6
    PAUSE 500
    LOW PORTC.6
    PAUSE 500
    GOTO SACKISI
    But it does not work. I'm missing something?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,243

    Default Re: Can't blink a led wih 16F1519

    I'm missing something?
    Turn off analog - or rather, turn on digital.
    Also, have you checked that the PBP default config for that chip is internal oscillator?

    /Henrik.

  3. #3
    Join Date
    Feb 2013
    Posts
    495

    Default Re: Can't blink a led wih 16F1519

    Yes I checked for intosc, also used meconfig

    Code:
    ;----[16F1519 Hardware Configuration]-------------------------------------------
    #IF __PROCESSOR__ = "16F1519"
      #DEFINE MCU_FOUND 1
    #CONFIG
    cfg1 = _FOSC_INTOSC           ; INTOSC oscillator: I/O function on CLKIN pin
    cfg1&= _WDTE_OFF              ; WDT disabled
    cfg1&= _PWRTE_OFF             ; PWRT disabled
    cfg1&= _MCLRE_ON              ; MCLR/VPP pin function is MCLR
    cfg1&= _CP_OFF                ; Program memory code protection is disabled
    cfg1&= _BOREN_OFF             ; Brown-out Reset disabled
    cfg1&= _CLKOUTEN_OFF          ; CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
    cfg1&= _IESO_OFF              ; Internal/External Switchover mode is disabled
    cfg1&= _FCMEN_OFF             ; Fail-Safe Clock Monitor is disabled
      __CONFIG _CONFIG1, cfg1
    
    cfg2 = _WRT_OFF               ; Write protection off
    cfg2&= _VCAPEN_OFF            ; VCAP pin function disabled
    cfg2&= _STVREN_ON             ; Stack Overflow or Underflow will cause a Reset
    cfg2&= _BORV_LO               ; Brown-out Reset Voltage (Vbor), low trip point selected.
    cfg2&= _LPBOR_OFF             ; Low-Power BOR is disabled
    cfg2&= _LVP_OFF               ; High-voltage on MCLR/VPP must be used for programming
      __CONFIG _CONFIG2, cfg2
    
    #ENDCONFIG
    
    #ENDIF
    
    ;----[Verify Configs have been specified for Selected Processor]----------------
    ;       Note: Only include this routine once, after all #CONFIG blocks
    #IFNDEF MCU_FOUND
      #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
    #ENDIF
    I've added ANSELC=%00000000 but no change.

  4. #4
    Join Date
    Oct 2009
    Posts
    596

    Default Re: Can't blink a led wih 16F1519

    No Expert, but according to the data sheet port c pin 6 has these options

    RC6/AN18/TX/CK

    Which I presume means an analogue pin, TX part of a serial port or a clock pin. You might have to set the port / pin as a digital IO

    REGISTER 12-14: ANSELC: PORTC ANALOG SELECT REGISTER
    R/W-1/1 R/W-1/1 R/W-1/1 R/W-1/1 R/W-1/1 R/W-1/1 U-0 U-0
    ANSC7 ANSC6 ANSC3 ANSC3 ANSC3 ANSC2 — —
    bit 7 bit 0
    Legend:
    R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
    u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
    ‘1’ = Bit is set ‘0’ = Bit is cleared
    bit 7-2 ANSC<7:2>: Analog Select between Analog or Digital Function on pins RC<7:2>, respectively
    0 = Digital I/O. Pin is assigned to port or digital special function.
    1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
    bit 1-0 Unimplemented: Read as ‘0’
    Note 1: When setting a pin to an analog input, the corresponding TRIS bit must be set to Input mode in order to
    allow external control of the voltage on the pin.

  5. #5
    Join Date
    Feb 2013
    Posts
    495

    Default Re: Can't blink a led wih 16F1519

    it does not works on any pin, whenever portC, D or any other...

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,243

    Default Re: Can't blink a led wih 16F1519

    You have MCLR enabled.
    Do you have a pullup on that pin and does your devices programmer (provided you're doing ICSP) release the MCLR signal, allowing the device to start up?

  7. #7
    Join Date
    Feb 2013
    Posts
    495

    Default Re: Can't blink a led wih 16F1519

    Henrik you're the best!
    it was MCLR issue, now it works as it should!

Similar Threads

  1. Blinking LED will not Blink
    By andybarrett1 in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 24th September 2014, 21:20
  2. led blink help needed
    By asifiqbal in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th March 2014, 16:10
  3. need led blink program
    By asifiqbal in forum General
    Replies: 6
    Last Post: - 4th March 2014, 11:26
  4. blink led 12f683
    By mel4853 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 19th January 2010, 22:39
  5. 10f206 Blink led
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th November 2005, 20:01

Members who have read this thread : 15

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