Pic 16f84a

Thread Starter

mhariharasudan

Joined Feb 18, 2010
6
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;
 

Markd77

Joined Sep 7, 2009
2,806
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.
 

Thread Starter

mhariharasudan

Joined Feb 18, 2010
6
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
 

Thread Starter

mhariharasudan

Joined Feb 18, 2010
6
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?
 

t06afre

Joined May 11, 2009
5,934
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
 
Top