1. mhariharasudan

    Thread Starter New Member

    Feb 18, 2010
    6
    0
    Hi,
    Am a completely a newbie to microcontrollers and their programming.Read about the PIC 16f84a programming in the net and tried out my own code in MPLAB IDE.I just tried a code to turn two led's on and off alternatively with some delay.When i compile the code, the build is suceeded.But when i Program it using PIC Start Plus Programmer and connect it to my circuit,I can observe that only one of my delay is working(i.e I could see only one led blinking).Please do help me with this.Thanks in advance.


    list p=16F84
    #include <p16F84.inc>
    __CONFIG _CP_OFF & _WDT_ON & _PWRTE_ON & _RC_OSC
    ERRORLEVEL -302 ;
    ORG 0x000
    goto main



    main

    bsf STATUS,5;
    movlw 00h;
    movwf TRISA;
    bcf STATUS,5;
    PORTA equ 05h;
    TRISA equ 85h;
    STATUS equ 03h;



    START

    COUNT1 equ 08h;
    COUNT2 equ 09h;



    movlw 04h;
    movwf PORTA;
    LABEL decfsz COUNT1,1;
    goto LABEL;

    movlw 02h;
    movwf PORTA;

    LABEL1 decfsz COUNT2,1;
    goto LABEL1;


    goto START;
     
  2. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    You need WDT_OFF in the config instead of WDT_ON. It is resetting itself every time the watchdog timer finishes.
    The flash rate will be very fast - too fast to see if you program it to a real device at 4MHz.
    This is useful for delays:
    http://www.piclist.com/tecHREF/piclist/codegen/delay.htm
    PIC16F84A is a very old chip - it is probably best to use 16F628 or 16F819 instead. They are much more advanced and probably cheaper.
     
  3. mhariharasudan

    Thread Starter New Member

    Feb 18, 2010
    6
    0
    Thanks a lot for the reply.I think am doing something wrong in the configuration.I am using a 4 Mhz oscillator for my circuit.The configuration ive used was wrong and so i changed it to XT_OSC.But still i couldnt get the correct output.Here is the link of the circuit ive used[​IMG]
     
  4. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I can't see the link.
    HS_OSC is recommended above 3.5MHz instead of XT_OSC
     
  5. mhariharasudan

    Thread Starter New Member

    Feb 18, 2010
    6
    0
    Thanks a lot,actually i didnt set the watch dog timer off in the configuration option while programming.Now i got the output correct.Thanks a lot.
    I had started another project with PIC 16F877A.I had downloaded CCS compiler for c programming of it.Is it possible to integrate it with MPLAB? Can i use PicStart Plus Programmer for programming it?
    My idea is to generate a square wave of 40 khz to give it to an ultrasonic transmitter and recieve the same via the reciever.Can u help me through this as am a new comer?
     
  6. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    The PicStart Plus programmer has been around for many years. So if you have an old version perhaps not. Microchip sell some upgrade kits. But instead of putting money in an upgrade I would rather go for a PICKIT 3 unit
    I would try to write a simple program for your 16f877. If you can program and verify the code then everything should be OK
     
  7. mhariharasudan

    Thread Starter New Member

    Feb 18, 2010
    6
    0
    Yea sure, thanks a lot.When u post me the code,ill check it out and let you know the same
     
Loading...