Going backwards, can't even get a basic blinky working now


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,659

    Question Going backwards, can't even get a basic blinky working now

    Started trying to get USART going on the LAB X1, but was getting garbage - couldn't figure it out, so I moved to a breadboard and started at the beginning. It doesn't get much more basic than this on a 16F877; blinky on pin D1.

    Code:
    #CONFIG
        __config _HS_OSC & _WDT_OFF & _WRT_OFF & _BODEN_ON & _LVP_OFF  & _CPD_OFF & _PWRTE_OFF & _DEBUG_OFF
    #ENDCONFIG
    
    DEFINE  OSC     20
    
    ADCON1 = 7              ' A/D off, all digital
    TRISD = %00000000
    PORTD = %00000000
    
    START:  PORTD = %00000000
            PAUSE   500      
            PORTD = %00000010
            PAUSE   500      
    
            GOTO    START
    Finish: end
    Compiled using PK4 successfully:

    Code:
    DFP Version Used : PIC16Fxxx_DFP,1.4.149,Microchip
    *****************************************************
    
    Connecting to MPLAB PICkit 4
    Currently loaded versions:
    Application version...........00.09.46
    Boot version..................01.00.00
    Script version................00.05.58
    Script build number...........abbfe90327
    Tool pack version ............1.15.1688
    Target voltage detected
    Target device PIC16F877 found.
    Device Revision Id  = 0x6
    Device Id = 0x9a0
    *****************************************************
    Erasing...
    Erase successful
    *****************************************************
    Erasing...
    The following memory area(s) will be programmed:
    program memory: start address = 0x0, end address = 0x1fff
    EEData memory
    Programming/Verify complete
     Program Report
    01-May-2023, 17:01:53
    Device Type:PIC16F877
    Program Succeeded.
    PK4 Verify Report
    01-May-2023, 17:01:53
    Device Type:PIC16F877
    *****************************************************
    The following memory area(s) will be verified:
    program memory: start address = 0x0, end address = 0x1fff
    EEData memory
    Verification successful.
    Verify Succeeded.
    • I added two power LEDs at the top to show both rails are powered.

      Blinky LED is on pin D1, and yet nothing happens.

      LED comes on if I manually apply 5V to pin.

      I've changed 20MHz OSC and caps.

      Changed MCU.

    I've been trying to figure this out for waaaay too long now, I feel I'm getting dumber by the minute.

    Robert

    Name:  Blinky 16F877.jpg
Views: 2626
Size:  181.2 KB


    EDIT: For a sec I thought my CONFIG was obsolete, but that looks ok.
    Last edited by Demon; - 1st May 2023 at 22:27.
    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!

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,659


    Did you find this post helpful? Yes | No

    Default Re: Going backwards, can't even get a basic blinky working now

    It gets dumber still.

    I use this code in parallel with a 18F4550.

    Code:
    INCLUDE "ALLDIGITAL.pbp"        ; Set all pins as digital
    
    TRISD = %00000000
    PORTD = %00000000
    
    PAUSE   2000      
    
    START:  PORTD = %10101010
            PAUSE   500      
            PORTD = %01010101
            PAUSE   500      
    
            GOTO    START
    Finish: end
    It compiles and works just fine on the Lab X1.

    It compiles on the breadboard, but doesn't run.

    I move it to the Lab X1, the darn thing runs fine...?

    ---------------------------------------------------

    3 ICs of 16F877 compile, but don't do nothing (including a new one from my stock).

    1 of the old ones compiles and runs on the Lab X1, it does nothing on the breadboard.

    Robert



    EDIT: Oh yeah, I'm using my "weirdo" cable for my X1, and my new cable for the breadboard.
    Last edited by Demon; - 1st May 2023 at 23:35.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,659


    Did you find this post helpful? Yes | No

    Default Re: Going backwards, can't even get a basic blinky working now

    Update: compiled that 16F877 on the Lab X1, it blinks, but it's not consistent.

    Works a bit, then stops.

    If I lightly touch the IC on the X1, it starts up for some random time period.

    Now I noticed I can wave my hand over the X1 to affect it.

    Robert


    EDIT: Linoleum floor, no carpet, barefeet.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,659


    Did you find this post helpful? Yes | No

    Default Re: Going backwards, can't even get a basic blinky working now

    Connected my Saleae probe to the oscillator on the 16F877 while it's on the X1, the thing spits out like crazy on both pins.

    Name:  16F877 osc at 20MHz on Saleae.png
Views: 2413
Size:  102.0 KB

    But when I connect to the osc while it's on the breadboard, nothing, no activity. Something is definitely wonky on that breadboard.

    I tried with 18, 22 and now 33pF caps just to eliminate that possibility.

    Might have dead circuits inside, that sucker's brand new too.

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,659


    Did you find this post helpful? Yes | No

    Default Re: Going backwards, can't even get a basic blinky working now

    This pic was just out of curiosity. I never saw what was going on during ICSP.

    Gotta love this probe.

    Name:  16F877 ICSP on Saleae.png
Views: 1893
Size:  87.5 KB

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,659


    Did you find this post helpful? Yes | No

    Default Re: Going backwards, can't even get a basic blinky working now

    I wonder if I haven't damaged by PICs with static somehow:
    - 2 of my workhorse aren't programming on breadboard, ZIF adapter or Lab X1.
    - 1 new one has the same problems.
    - 1 workhorse works, but intermittently.
    - and then there's the 18F4550 that just works, on anything.

    I've handled all these ICs the same, same surfaces, same work area, nobody else here messing with them.

    I must be doing something really dumb on the Lab X1, my configs or osc setting. Thing is, I haven't changed anything, the X1 OSC jumpers are always set at 20 MHz for all my ICs (A12, B12 and C23, J3 is at top position when looking at the X1 properly).

    I set the 18F4550 for 1 second blink intervals, and it seems to be keeping time. I also set the 16F877 at 1 second blink intervals, but it seems to be going twice at fast.

    Also, the 16F877 take a long time to erase and program; the 18F4550 takes a fraction of that, maybe 25% at max. And it's technically the same code, just the config changes.

    Robert

Similar Threads

  1. DT_INTS-14 (Blinky Light) Help ?
    By andybarrett1 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th November 2015, 21:28
  2. Replies: 3
    Last Post: - 15th April 2015, 04:58
  3. 12F683 - basic code not working
    By Scampy in forum mel PIC BASIC Pro
    Replies: 56
    Last Post: - 12th February 2014, 00:29
  4. Blinky not working with TOGGLE
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2008, 08:45
  5. My first Blinky!
    By nomad in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 25th September 2007, 17:29

Members who have read this thread : 1

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