I have have the following program and one LED
connected to every port pin. All pins are outputs. The problem is that LEDs
connected to RA4/TOKI and RB4,5,6,7 don't blink. During the simulation
everything seems to work. I have MPLAB V3,40.
In fact this is a test program for 16F84 and i
am using 220Ù resistors to interface the LEDs.
As Matt said "RA4 is an open drain
output only- it has no way of sourcing current. If you want to use it to
drive an LED- you have to attach one end of the LED (through a resistor) to +5
and connect the other end to RA4. Setting RA4 will turn LED off, clearing
RA4 will turn the LED on." I tried it and it didn't
work. I also tried to drive a 4 to 16 decoder (less current consumption) and
that didn't work either.
As far as RB4,5,6,7 are concerned they still
don't work.
I had some replies but only Matt helped me. I dont want you to
send me delay routines. I want to find out whats wrong and it doesn't work.
Maybe there is a mistake in the program (it is working during simulation) or i
haven't configured a register corectly or even not at all. I have to say that i
dont know much about PICs but i am trying.
I thank you in advance AHILLEAS.
list
p=16f84
#include
"p16f84.inc"
porta equ 05
portb equ 06
status equ
03
trisa equ 85
trisb equ 86
del equ 20
del1 equ
21
org
0
start
clrf porta
clrf portb
bsf status,5
clrf trisa
clrf trisb
bcf status,5
start1
incf
porta
incf portb
movlw
h'ff'
movwf del1
delay1
movlw
h'ff'
movwf del
delay
decfsz del
goto
delay
decfsz del1
goto
delay1
goto
start1
end