Maker Pro
Maker Pro

led blink pic 16F877

S

sinner

I've tried (with no success) to get a simple led blink program running on
the 16F877. !MCLR is +5v through a 10k res, Vdd is +5v, Vss is 0V, I have
a .1uF ceramic cap across Vdd and Vss. OSCout is pulsing, which makes me
think the chip is 'running' and not locked up. I have a canned
oscillator on OSCin. To avoid floating inputs, I have set all pins as
outputs.

Here is my code, beter yet, does anyone have a known working led blink for
this chip? It would help infinitely.

http://www.cs.ttu.edu/~marquez/pic/

only led_blink.asm and p16f877 are being used to blink an led on RD_0.

Thanks anyone.
 
L

loedown

Hi All,
You need to place a 1K resistor or higher on MCLR, with a
capacitor of 100nF or higher, one side of resistor goes to Vdd, one side of
cap goes to Gnd.

+
|
R
|
----------MCLR
|
C
|
gnd


You may also have the problem, that the unit is flashing, but you haven't
calculated the on / off times correctly and it is flashing at a higher
frequency than the eye can detect.

Below is a sample code for PIC 12F675 for led flasher

include "p12f675.inc"
;******************************************************
org 0000
bcf status,5
clrf gpio
movlw b'00000111'
movwf cmcon
movlw b'00000000'
movwf intcon
movlw b'00110101'
movwf t1con
bsf status,5
clrf trisio
movlw b'00000001'
movwf pie1
movlw b'11000111'
movwf option_reg
clrf ansel
bcf status,5
movlw b'00010000'
movwf gpio
movlw b'00000000'
;******************************************************
loop btfsc pir1,0
goto bitset
goto loop
bitset btfsc gpio,4
goto set1
btfss gpio,4
goto clear1
set1 bcf gpio,4
bcf pir1,0
goto loop
clear1 bsf gpio,4
bcf pir1,0
goto loop
end


I have also found the chips can be a little susceptable to outside noise, so
you may require 4K7 resistors on unused inputs, although for this project
it's not really required.

Before anyone mentions the weak pull ups (WPU), I found they were not really
enough to block the noise and stop false triggering of the chip

Paul
 
L

loedown

Greetings Mentor, master of the PIC

The man solely responsible for me spending money and considerable time on
these little blighters

Paul
 
L

loedown

Hi All,
With great success, thanks.

One was programmed to activate a modified video for surveillance work, when
a PIR was triggered it would record for 2 minutes and then shut down, wait
for the next trigger.

One was used to detect when a voltage line failed or started.

One was used to set my JX-3P synth to automaticaly not be in omni mode, but
only to receive on channel 1 ( MIDI )

Paul
 
Top