Probleme mit Programm (LED-Blinklicht)
Ich bin Anfänger im Pic-Programmieren und möchte mir deshalb zur Übung erst einmal ein LED-Blinklicht/Lauflicht bauen. Dazu verwende ich einen PIC16F88, den ich nach folgendem Schaltplan angeschlossen habe:
Bild hier
Es sind allerdings mehrere LEDs an Port A Pins angeschlossen.
Dazu habe ich folgendes Programm für den PIC16F88 angepasst und mit dem Brenne 8 MiniP von Sprut auf den Chip gebrannt:
Code:
#include P16f88.INC
;*****Set up the Constants****
STATUS equ 03h ;Address of the STATUS register
TRISA equ 85h ;Address of the tristate register for port A
PORTA equ 05h ;Address of Port A
COUNT1 equ 20h ;First counter for our delay loops
COUNT2 equ 21h ;Second counter for our delay loops
;****Set up the port****
bsf STATUS,5 ;Switch to Bank 1
movlw 00h ;Set the Port A pins
movwf TRISA ;to output.
clrf ANSEL
bcf STATUS,5 ;Switch back to Bank 0
;****Turn the LED on****
Start movlw 1Fh ;Turn the Port A LEDs on by first putting it
movwf PORTA ;into the w register and then on the port
;****Add a delay
call Delay
call Delay
;****Delay finished, now turn the LED off****
movlw 00h ;Turn the LEDs off by first putting it
movwf PORTA ;into the w register and then on the port
;****Add another delay****
call Delay
call Delay
;****Now go back to the start of the program
goto Start ;go back to Start and turn LEDs on again
;****Here is our Subroutine
Delay
Loop1 decfsz COUNT1,1 ;This second loop keeps the LEDs
goto Loop1 ;turned off long enough for us to
decfsz COUNT2,1 ;see it turned off
goto Loop1 ;
return
;****End of the program****
end ;Needed by some compilers, and also
;just in case we miss the goto instruction.
Allerdings habe ich jetzt das Problem, dass die LEDs konstant leuchen, anstatt wie zu erwartend zu blinken. Ich vermute, dass ich irgendetwas mit dem Delay falsch gemacht habe, sehe aber nicht was. Könnt ihr mir hier bitte weiterhelfen ?