PIC16F877A not working


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Lucky guy, i feel generous today
    Code:
            asm        
            ifdef PM_USED
                device  pic16F877A, xt_osc, wdt_on, lvp_off, protect_off
            else
                __config _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
            endif
            endasm
            
            PORTA = 0
            PORTB = 0
            TRISA = 0
            TRISB = 0
            ADCON1 = 7
            CMCON = 7 
            
            CounterA VAR BYTE
            
    Start:
            for CounterA = 0 to 5
                PORTA = DCD CounterA
                PAUSE 250
                NEXT
            PORTA = 0
            
            FOR CounterA = 0 TO 7
                PORTB = DCD CounterA
                PAUSE 250
                NEXT
            PORTB = 0
                    
            GOTO Start
    make sure you properly filter the PSU line and the PIC is powered , make sure MCLR line is tied to Vdd, make sure PGM pin is loaded to GND while programming, and also make sure you have a crystal + caps attached to the PIC. The above assume a 4MHz crystal/resonator.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I have the circuit setup in the normal way. 10K resistor between VDD and MCLR. 4MHz resonator. 100uf capacitor plus 3 smaller ones. I dont know what PGM is. My programmer supports this type of chip so i would assume it sets that for me. I have never had trouble with these kind of chips before. I have tested 2 chips to be sure.

    I dont quite understand all of your code but i will try it anyway. How come you only set ports A and B? If im not using the others then dont i need to put anything in about them? Not even trisc/trisd?

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Well yes and no. Here it's an example, and i don't use the other PORTs, they're just tied to GND with some pull-down resistors... if not defined, TRISC, TRISD should have their own POR value. Usually set to $FF, have a look at the datasheet, you should find a section about the Power-On Reset values (POR)

    don't worry, it works.

    Make sure you have connected ALL Vss and ALL Vdd, unless it may not work as expected.

    If it's still don't work, program your PIC with the code above, then read it back, save the .HEX file to another FileName and post it here.. maybe there's a strange issue somewhere. Who knows.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I have connected all 4 power pins but ive not grounded the outputs. I know your supposed to but ive never had a problem with it before. Ill give it a test maby tomoz, got a bit of a party goin off today

Similar Threads

  1. PIC16F877A PORTA.2 not working
    By The Master in forum Off Topic
    Replies: 2
    Last Post: - 10th October 2009, 18:16
  2. PIC16F877A analog problem
    By DeViLa_Q8 in forum mel PIC BASIC
    Replies: 0
    Last Post: - 30th July 2009, 20:19
  3. PIC16F877A for application in mobile robot...
    By mcbeasleyjr in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th January 2009, 14:47
  4. PIC16F877A not working again :(
    By The Master in forum Off Topic
    Replies: 24
    Last Post: - 30th October 2008, 00:04
  5. communicating pic18f452 with pic16f877a
    By tamersoss in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th July 2007, 19:54

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