bonjour tous le monde, voila j`ai un petit soucis avec mon code.
ce que je voulais faire , c`est de lire les donnee d`une telecomande transmettant des donnes RC5 en me servant d`un pic 16f84a, et des led comme interpretation.
la ou j`habite<a l`ile maurice, vous connaisez??> pour trouver un recepteur infra rouge, c`est pas evident, donc du coup j`ai dit pourquoi ne pas connecter ma telecommande directement au pic.
sa lis quelque chose, mais c`est pas ce que j`attendais ,et des fois quand j`appuie deux fois sur la meme touche,il y a different led qui s`illumine.
comme vous allez le constater, j`ai rajouter quelque signal au port1 pour pouvoir regarder ou se fait la lecture a chaque fois en me servant d`un "osciloscope"<excusez moi, je ne sait pas si c`est le mot exact en francais>
voici le code que j`ai ecrit;
STATUS equ 03h
TRISA equ 85h
TRISB equ 86h
PORTA equ 05h
PORTB equ 06h
COUNT1 equ 08h
COUNT2 equ 09h
LOOP equ 0ch
DONN1 equ 2Fh
RC5_DATA equ 0Dh
;---------------------------------
bsf STATUS,5
movlw b'00001'
movwf TRISA
movlw 00h
movwf TRISB
bcf STATUS,5
;---------------------------------
START ;get starting bit
BTFSS PORTA,0 ;IF 1 SKIP
goto START
movlw b'11110'
movwf PORTA
movlw b'00000'
movwf PORTA
;---------------------------------
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY
call DELAY ;delay of 13.28mS
;---------------------------------
movlw d'6'; read only last 6 bit
movwf LOOP
clrf DONN1
clrf RC5_DATA
next_bit
rlf DONN1,1
bcf DONN1,0 ;SET BIT 0 TO 0
SETBIT
BTFSC PORTA,0 ;IF 0 SKIP
bsf DONN1,0 ;SET BIT 0 TO 1
movlw b'11110'
movwf PORTA
movlw b'00000'
movwf PORTA
call SHORT
call SHORT
call SHORT
call SHORT
call SHORT
call SHORT
call SHORT ;1.75 Ms delay
decfsz LOOP,1
goto next_bit
clrf PORTB
movfw DONN1 ; move the six bit to DONN1
andlw b'00111111' ; remove unnessry bit
movwf RC5_DATA; move value to "RC5_DATA"
DISPLAY
MOVFW RC5_DATA
MOVWF PORTB
goto DISPLAY
goto START
;---------------------------------
DELAY
movlw d'249'
movwf COUNT1
LOOP1 decfsz COUNT1,1
goto LOOP1
RETURN
SHORT movlw d'82'
movwf COUNT2
LOOP2 decfsz COUNT2,1
goto LOOP2
RETURN
;--------------------------------
FINISH
end
;;j`ai mit directement les deux fil du transmetteut l`un sur le -ve et l`autre a portA,0
merci en avance.