voila mon programme , s'il vous plais veuillez m'indiquer où ce trouve le problème , sachant que MPLAB ne signal aucune erreur
je vous signale que ça represente une simulation ISIS, donc ce n'est pas la peine de mettre ni l'oscillateur ni des résistances ni Power source
Code : Tout sélectionner
;***************************** ****************************** ***********
; *
; Fait clignoter une LED *
; *
;***************************** ****************************** ***********
; *
; NOM: LED CLIGNOTANTE AVEC TIMER0 *
; *
; *
;***************************** ****************************** ***********
; *
; Fichier requis: P16F84a.inc *
; *
; *
; *
;***************************** ****************************** ***********
; *
; Notes: Utilisation didactique du boucle en mode interruption *
; *
;***************************** ****************************** ***********
list p=16f84a, f=inhx8m, r=dec
include "p16f84a.inc"
__CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON & _WDT_OFF
; '__CONFIG' précise les paramètres encodés dans le processeur au moment de
; la programmation du processeur. Les définitions sont dans le fichier include.
; Voici les valeurs et leurs définitions :
; _CP_ON Code protection ON : impossible de relire
; _CP_OFF Code protection OFF
; _PWRTE_ON Timer reset sur power on en service
; _PWRTE_OFF Timer reset hors-service
; _WDT_ON Watch-dog en service
; _WDT_OFF Watch-dog hors service
; _LP_OSC Oscillateur quartz basse vitesse
; _XT_OSC Oscillateur quartz moyenne vitesse
; _HS_OSC Oscillateur quartz grande vitesse
; _RC_OSC Oscillateur à réseau RC
;***************************** ****************************** **********
; ASSIGNATIONS *
;***************************** ****************************** **********
optionval equ b'10000000' ; Valeur registre option
; Résistance pull-up OFF
; Préscaler timer à 256
intconmask equ b'10010000' ;Interruptions sur rb0/int
#DEFINE interruptport PORTB,0
;***************************** ****************************** **********
; DECLARATIONS DE VARIABLES *
;***************************** ****************************** **********
cblock 0x00c
wtemp
statustemp
n1
n2
n3
val
endc
;***************************** ****************************** **********
; MACRO *
;***************************** ****************************** **********
bank0 macro
bcf STATUS,RP0
endm
bank1 macro
bsf STATUS,RP0
endm
;***************************** ****************************** ***********
; DEMARRAGE SUR RESET *
;***************************** ****************************** ***********
org 0x00
goto init
;***************************** ****************************** ***********
; ROUTINE INTERRUPTION *
;***************************** ****************************** ***********
;sauvegarder registres
;------------------------
org 0x04
movwf wtemp ; sauver registre W
swapf STATUS,w ; swap status avec résultat dans w
movwf statustemp
; switch vers différentes interrupts
; inverser ordre pour modifier priorités
; ----------------------------------------
btfsc INTCON,T0IE
btfss INTCON,GIE
goto inte
call intt0
bcf INTCON,T0IF
goto restoreg
inte
btfsc INTCON,INTE
btfss INTCON,GIE
goto rbie
call intinte
bcf INTCON,INTF
goto restoreg
rbie
btfsc INTCON,RBIE
btfss INTCON,GIE
goto intpei
call intrbie
bcf INTCON,RBIF
goto restoreg
intpei
btfsc INTCON,EEIE
btfss INTCON,GIE
goto restoreg
call inteeie
restoreg
swapf statustemp,w ; swap status avec résultat dans w
movwf STATUS
movf wtemp,w ; sauver registre W
retfie
;***************************** ****************************** ***********
; INTERRUPTION TIMER 0 *
;***************************** ****************************** ***********
intt0
return
;***************************** ****************************** ***********
; INTERRUPTION RB0/INT *
;***************************** ****************************** ***********
intinte
bank0
movlw 0xff
movwf PORTA
call tempo
movlw 0x00
movwf PORTA
call tempo
movlw 0xff
movwf PORTA
call tempo
movlw 0x00
movwf PORTA
call tempo
return
;***************************** ****************************** ***********
; INTERRUPTION RB0/RB4 *
;***************************** ****************************** ***********
intrbie
return ; fin d'interruption RB0/RB4
; peut être remplacé par
; retlw pour retour code d'erreur
;***************************** ****************************** ***********
; INTERRUPTION EEPROM *
;***************************** ****************************** ***********
inteeie
return ; fin d'interruption eeprom
; peut être remplacé par
; retlw pour retour code d'erreur
;***************************** ****************************** **********
; Fonction de temporisation *
;***************************** ****************************** **********
tempo ; une temporisation de presque deux secondes
movlw 1
movwf n1
tempo1
movlw 0xff
movwf n2
tempo2
movlw 0xff
movwf n3
tempo3
decfsz n3
goto tempo3
decfsz n2
goto tempo2
decfsz n1
goto tempo1
return
;***************************** ****************************** **********
; INITIALISATIONS *
;***************************** ****************************** **********
init
bank1
movlw optionval ; charger masque
movwf OPTION_REG ; initialiser registre option
movlw intconmask ; charger masque
movwf INTCON ;charger interrupt control
bsf interruptport ; configurer rb0 comme une entrée
clrf TRISA ; PORTA est configuré comme sorties
bank0 ; accés à la banque 0
;***************************** ****************************** **********
; PROGRAMME PRINCIPAL *
;***************************** ****************************** **********
start
movlw 0x1f ; allumer les cinq leds de PORTA
movwf PORTA
goto start
end
voila le schèma:




