Merci pour ton aide, j'ai essayé de modifier mon code et ça donne ça
:
list p=18f2620 ; Définition de processeur
#include <p18F2620.inc> ; Fichier include
__CONFIG _CONFIG1H, _OSC_INTIO7_1H ; INT RC-CLKOUT on RA6, PORT on RA7
__CONFIG _CONFIG2L, _BOREN_OFF_2L&_PWRT_ON_2L
__CONFIG _CONFIG2H, _WDT_OFF_2H
__CONFIG _CONFIG4L, _DEBUG_OFF_4L&_STVREN_ON_4L&_LVP_OFF_4L
__CONFIG _CONFIG5L, _CP0_OFF_5L&_CP1_OFF_5L&_CP2_OFF_5L&_CP3_OFF_5L
__CONFIG _CONFIG5H, _CPB_OFF_5H&_CPD_OFF_5H
__CONFIG _CONFIG6L, _WRT0_OFF_6L&_WRT1_OFF_6L&_WRT2_OFF_6L&_WRT3_OFF_6L
__CONFIG _CONFIG6H, _WRTB_OFF_6H&_WRTC_OFF_6H&_WRTD_OFF_6H
__CONFIG _CONFIG7L, _EBTR0_OFF_7L&_EBTR1_OFF_7L&_EBTR2_OFF_7L& _EBTR3_OFF_7L
__CONFIG _CONFIG7H, _EBTRB_OFF_7H
; ------------Direction des ports I/O--------------
val_baud equ d'25'
DIRPORTA EQU B'11010100' ;
DIRPORTB EQU B'11111111'
DIRPORTC EQU B'10111111' ; RC7 en entrée & RC6 en sortie
org 0 ; le reset vector est placé en 0x00h
goto start
;***********************************************************************;
; ;
; PROGRAMME PRINCIPAL ;
; ;
;***********************************************************************;
org 0x20
start
call init
;***********************************************************************;
; TRANSMISSION ;
;***********************************************************************;
;loop ; Boucle de transmission et de réception
trans
bsf TXSTA,TXEN,0 ; Mets à 1 TXEN pour emettre
btfss TXSTA,TRMT,0 ; Test pour savoir si octet présent ds registre
goto trans ; de transfert (1 = vide)
movlw 0x50 ; Envoi de 0x50
movwf TXREG,0
bcf TXSTA,TXEN,0 ; Arret de la transmision
goto trans
;***********************************************************************;
; RECEPTION ;
;***********************************************************************;
;recep
;bsf RCSTA,CREN,0 ; On établi la reception permanente
;btfss PIR1,RCIF,0 ; tester si = 1 message recu
;goto recep ; non = 0 attendre
; movf RCREG,0,0 ; charger octet recu
; bcf RCSTA,CREN,0 ; On arrete la reception
;goto loop
;***********************************************************************;
; ;
; INITIALISATIONS ;
; ;
;***********************************************************************;
init
;----Initialisation des ports
movlw 0x07
movwf ADCON1,0
clrf PORTA,0
clrf PORTB,0
clrf PORTC,0
movlw DIRPORTA
movwf TRISA,0
movlw DIRPORTB
movwf TRISB,0
movlw DIRPORTC
movwf TRISC,0
;----- Initialisation Quartz 8Mhz------;
movlw b'01110000' ; Valeur pour 8Mhz
movwf OSCCON,0 ;
Stable btfss OSCCON,IOFS,0 ; Frequence stable?
bra Stable ; Non, donc boucle
;------- Initialisation liaison serie--------
;
INIT232 bcf PORTC,TX,0
bsf PORTC,RX,0
movlw b'10010000' ; SPEN=1, CREN=1
movwf RCSTA,0 ;
movlw b'00100100' ; TXEN=1, SYNC=0, BRGH=1
movwf TXSTA,0 ;
clrf BAUDCON,0 ; 8 bit SPBRG
movlw val_baud ; Valeur pour 19.2kb (8-mhz)
movwf SPBRG,0 ;
movf RCREG,W,0 ; Efface le buffer Rx
RETURN
END
Pour le moment j'ai désactivé la réception
. Car la fonction de transmission toute seule ne marche pas ! Vous savez pourquoi? Pour le moment je voudrai juste envoyer en continu. Sinon est il necessaire de mettre le ",0" pour faire des operations dans les registres suivant les banques?
Merci 