gastonanthony
New Member
hi guys, I made a simple PIC16f84A code (I have no other choice bec. this is the type of pic assigned for the homework) for differrent LED patterns, I simulated it in MPLAB very nicely, but wouldn't work when connected to the hardware, the PIC wouldn't respond to inputs
here's the code:
hope somebody could help me out
here's the code:
Code:
PROCESSOR 16f84a
#include "P16f84a.inc"
COUNT1 EQU 08h
COUNT2 EQU 09h
clrf PORTA
bsf STATUS,5
movlw 00h
movwf TRISB
movlw 0Fh
movwf TRISA
bcf STATUS,5
goto Start
; Make all LEDs Blink
ALLBLINK
movlw 0FFh
movwf PORTB
btfss PORTA,3 ;RA4 is the reset button
goto Start
call DELAY1
movlw 00h
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
goto ALLBLINK
RUNNING
movlw b'00000000'
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
movlw b'00000001'
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
movlw b'00000010'
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
movlw b'00000100'
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
movlw b'00001000'
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
movlw b'00010000'
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
movlw b'00100000'
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
movlw b'01000000'
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
movlw b'10000000'
movwf PORTB
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
goto RUNNING
COUNTUP
clrf PORTB
incf PORTB
btfss PORTA,3 ;RA4 is the reset button
goto Start
call DELAY1
btfss PORTA,3 ;RA4 is the reset button
goto Start
goto COUNTUP
DELAY1
Loop1 btfss PORTA,3 ;RA4 is the reset button
goto Start
decfsz COUNT1,1
goto Loop1
decfsz COUNT2,1
goto Loop1
return
Start movlw 0FFh
movwf PORTA
movlw 0FFh
movwf PORTB ;all lights on
btfss PORTA,0
goto ALLBLINK
btfss PORTA,1
goto RUNNING
btfss PORTA,2
goto COUNTUP
goto Start
end
hope somebody could help me out