i just wanna to blink this microcontroller !

Status
Not open for further replies.
hi
it almost a month after my PIC16F877A arrived
i never program it with a right program
and now i want to blink a led using 16F877A
to check is it still alive
if anyone could give a source code for this
it would be helpful !
 
What can you convert? State which compiler.

Edit: Also, what hardware do you have?

Mike.
 
Last edited:
Code:
;*************************************
Code:
[SIZE=2];WORLDS SIMPLEST PROGRAM             *[/SIZE]
[SIZE=2];  18-5-2010                         *[/SIZE]
[SIZE=2];                                    *[/SIZE]
[SIZE=2];************************************[/SIZE]
 
[SIZE=2]list p=12F629[/SIZE]
[SIZE=2]radix dec[/SIZE]
[SIZE=2]include "p12f629.inc"[/SIZE]
 
 
 
[SIZE=2]__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_ON & _INTRC_OSC_NOCLKOUT  ;Internal osc.[/SIZE]
 
[SIZE=2];************************************[/SIZE]
[SIZE=2];Beginning of program[/SIZE]
[SIZE=2];************************************[/SIZE]
[SIZE=2]  org  0x00[/SIZE]
[SIZE=2]  bsf  status, rp0    ;bank 1  [/SIZE]
[SIZE=2]  bcf  TRISIO,4      ;GP4 output  [/SIZE]
[SIZE=2]  movlw   b'00000111'     ;bit3=1=WDT  011= /8 WDT=18mSx8=0.144Sec[/SIZE]
[SIZE=2]  movwf   option_reg      ;must be in bank 1[/SIZE]
[SIZE=2]  bcf  status, rp0  ;bank 0 [/SIZE]
[SIZE=2]  movlw b'00010000'  ;to toggle GP4[/SIZE]
[SIZE=2]  xorwf GPIO,f[/SIZE]
[SIZE=2]  sleep[/SIZE]
 
[SIZE=2]END[/SIZE]

Change config to your processor and make sure wdt is active.
change gpio to the port you want to use and the pin containing the LED and 470R resistor.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…