begin process at 2010 02 09 22:22:04
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Les PIC

 > 16F628/84 : DÉCODEUR RC5 , LCD ET 6 SORTIES

16F628/84 : DÉCODEUR RC5 , LCD ET 6 SORTIES


 Information sur la source

Note :
9,67 / 10 - par 3 personnes
9,67 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Les PIC Niveau :Débutant Date de création :06/01/2005 Date de mise à jour :10/01/2005 02:41:32 Vu / téléchargé :18 612 / 1 764

Auteur : rylryl

Ecrire un message privé
Site perso
Commentaire sur cette source (33)
Ajouter un commentaire et/ou une note

 Description

Permet le décodage d’une télécommande RC5 , d’afficher quelques résultas sur un écran LCD 4x16 et de commander 6 sorties en fonction de vos besoins.
Le fichier « Montage_LCD.bmp » est une aide pour la connectique.
ryl…



 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Historique

10 janvier 2005 02:41:32 :
Moins de "call lcd_putchar" inutile.

 Sources du même auteur

Source avec Zip 16F628 :CHRONOMÈTRE/HORLOGE DE PRÉCISION ET LCD
Source avec Zip 16F628/84 : LCD, CARACTÈRES SPÉCIAUX ET TEXTE AUTO DÉFILANT ...
Source avec Zip 16F84:GÉNÉRATEUR DE TXT SUR LCD 4X16

 Sources de la même categorie

Source avec Zip SAUT AVEC TROIS IMPULSIONS par ariane2005
Source avec Zip LED ROTATE par ariane2005
Source avec Zip LED EN COULEUR par ariane2005
Source avec Zip JEUX DE LUMIÈRE par ariane2005
PIC : OBTENIR UN NOMBRE ALÉATOIRE AVEC LA FORMULE XN+1=(137... par warezpsx

Commentaires et avis

Commentaire de pionpion69 le 06/01/2005 17:36:34

nickel merci! :-)

Commentaire de rylryl le 06/01/2005 17:53:10

Merci Mr pionpion69
a me fait plaisir!
ryl...

Commentaire de ManChesTer le 09/01/2005 02:17:20 administrateur CS

Super utile, merci

ManChesTer.

Commentaire de rylryl le 09/01/2005 02:44:45

Waow!! super grand merci , chuisul c....!!
ryl...

Commentaire de ManChesTer le 09/01/2005 18:49:24 administrateur CS

rylryl, sois pas si étonné,

Ton code est bien ecrit, clair et fonctionnel et super bien commanté, il est facile pour tous de la modifier selon ses besoin ou de l'utiliser tel quel.

Juste une remarque : un call a lcdputchar a chaque caratère c'est un peux lourd. Faire une routine lcdputstring ne serais-ce pas mieux ?

Bon Coding...

ManChesTer.

Commentaire de rylryl le 09/01/2005 19:01:25

Tu a raison Mr Manchester ce soir ou demain je ferais une MAJ !
Encore merci pour cette bonne remarque!
a bientot.
ryl...

Commentaire de pjm130 le 17/05/2005 10:06:16

Merci pour ton prog effectivement il est clair net et precis et simple a comprendre meme les les plus nul des debutants comme moi.
J'ai tellement compris que j'ai meme vu que pour que ton programme fonctionne sur d'autre pic qui fonctionne a des freq plus elever il faut modifier la tempos.
Je fonctionne a 20MHz et la je ne sais pas comment faire pour retrouver une bonne tempos..
Si j'interprete ,une tempos fait un certains nombre de boucle,chaque boucle contient des mnemonique qui mettent un certain nombre de cycle
chaque cycle corrspond a une fraction de periode du quartz...
suis je ok?
Mais apres comment on fait j'y arrive plus???
Lors du calcul du nombre de cycle tu commence a partir de l'appelle du ss porg (call Tempo444),a partir du chargement des compteur dans le ssprog(Tempo444 movlw 0x09) ou a partir du debut de la premiere boucle(tim0 movwf Loop1)
Ma frequence est cinq fois plus grande que celle que tu utilise je dois donc faire cinq fois tes tempos?????

Commentaire de rylryl le 17/05/2005 14:06:25

Salut pjm130.
Bem il faut juste multiplier les tempo par 5...
Attention aussi aux tempos du LCD !!
voili..
a+
ryl...

Commentaire de pjm130 le 17/05/2005 14:58:05

OK c'est super sympas de ta part.....
J'ai enlever la partie lcd car je prepare juste une reception rc5
MERCI MERCI BEAUCOUP

Commentaire de piceuro le 01/06/2005 20:16:41

bonjour
je suis un novice dans le site
je me suis inscrit mais pour accéder a ton montage on me
demande a nouveau de m'inscrire en tant que membre du club.
Il faut appaeller un numéros surtaxer mais le site ne dit pas le prix .
Pourrais tu me donner plus d'info.
en ce moment je suis en train de fabriquer un ampli most fet et ton montage ma donner des idées!! Merci par avance tchao!!

Commentaire de rylryl le 01/06/2005 20:54:28

Bonjour PICEURO.
Adresse toi plutôt aux administrateurs car là ché pô t'aider !
a+
ryl...

Commentaire de pionpion69 le 01/06/2005 21:04:36

je t'ai envoyé un message perso PICEURO.

A+ Pionpion


P.S. Salut Rylryl!

Commentaire de BruNews le 01/06/2005 21:25:50 administrateur CS

S'inscrire en 'membre club' est juste une manière de soutenir CS mais absolument pas obligatoire, suffit de cliquer sur 'Téléchatger le zip'.

Commentaire de rylryl le 18/08/2005 15:55:25

Bonjour, pour les plus bricoleurs, je mets a disposition une Télécommande universelle pour PC.
Si quelqu'un est intéressé,
c'est ici : http://pageperso.aol.fr/CRylou/TC_UNIV_rylryl.html
Bon pilotage !

rylryl...

Commentaire de pionpion69 le 18/08/2005 16:41:09

sympa comme logiciel félicitation!

Commentaire de rylryl le 18/08/2005 18:18:30

Merci Pionpion69...

A+
rylryl...

Commentaire de spokitus le 18/08/2006 14:06:45

Enfin un code qui marche pour décoder du rc5. Merci!! On en redemande.

Commentaire de sentekin le 21/11/2006 11:40:33

RC5 PROTOKOL RECEIVER STANDBY(12-BINARY 001100 COMMAND-TV-VCR-SAT)BUTTON START-STOP ROLE
IR ÝNPUT RA3 ,OUTPUT RA1 CÝRCUIT AND 16F84 ASM AND HEX FILE PLACE.TAHNK YOU.
sentekin48@hotmail.com

Commentaire de rylryl le 21/11/2006 12:46:39

Bonjour SENTEKIN,

Que veux-tu dire ?????
J'ai ce message sur plusieurs sources "RC5" !!!
Il y a aussi celle-ci:
http://www.vbfrance.com/codes/USB-DECODEUR-RC5-POUR-TELECOMMANDE-TV-VCR-AVEC_39418.aspx

A+
ryl...

Commentaire de sentekin le 21/11/2006 13:01:25

Merci RYLRYL le NO LCD 16f84 role output transistör rc5 protocol
decoder asm and hex merci.

Commentaire de rylryl le 21/11/2006 15:15:07

Re,

SENTEKIN, je suis désolé mais je ne comprends toujour pas ce que tu veux ???
Peux-tu être plus clair...
Si c'est un exemple de décodage RC5 depuis un PIC télécharge le ZIP "en haut de la page" il y a le fichier ASM et le fichier HEX...

PS: MERCI a l'administrateur pour la correction...

ryl...

Commentaire de BruNews le 21/11/2006 15:26:38 administrateur CS

de rien...

Commentaire de delphiman007 le 09/02/2007 17:47:39

Bonjour et merci pour ce code.
Je ne comprend pas le point suivant:
Dans la partie Recv_RC5
On attend un "0" ce qui indique le depart de la trame.
Donc quand on a ce "0" c'est que l'on ce trouve au départ de la deuxieme partie du bit 1.
Mais c'est là que je comprend plus :
1/2 bit = 889µs donc pourquoi cette tempo de 444µs qui logiquement ne nous fais pas aller au 1/2 bit suivant mais toujours dans le même 1/2 bit ( donc toujours "0")
Je pense que mon analyse est fausse puisque ça marche mais pourquoi cette tempo de 444µs?
Si je comprend bien, quand le "0" et détecté on n'est pas au debut du deuxieme 1/2bit mais bien après la moitié de ce 1/2 bit! Heuuuuu ! Non! Oui ?
Si je peut avoir une petite explication Merci.

@+

Commentaire de rylryl le 09/02/2007 18:26:42

Bonjour et merci,

Il y a englobé le bit de start qui est sauté puis syncro sur le demi bit suivant,
en fait cette tempo sert de controle pour savoir si c'est un début de code RC5 (START) ou savoir si c'est une reception parasite...

A+
ryl...

Commentaire de delphiman007 le 09/02/2007 21:56:05

Re,
Donc à la reception du "0" on est donc bien apres les 3/4 du 1er bit !
Ce temps de retard est du a quoi ?
A la réaction du recepteur Ir?
Mais en fait pourquoi ne pas avoir mis une tempo de 889µs on serais aussi sur la 1er partie du 2eme bit ?
Ou alors j'ai toujours pas compris !!
j'ai oublié : Merci pour être aussi rapide a repondre!

@+

Commentaire de rylryl le 11/02/2007 13:38:13

Re,

Oui, a la réception on est a 3/4 du bit, c'est un choix ! le principal étant d'être synchronisé... le décalage est du au contrôle que je fait au niveau du bit de départ en vérifiant qu'il y est un changement d'état sur RB6 ce qui occasionnera ou pas un rejet.
On aurai aussi pu vérifier la durée du bit de start ou la durée des bits de toute la trame...Mais les essais m'ont démontrés que ce n'était pas utile(ayant une réussite de décodage trame de 100%).

Bonne prog
A+
ryl...

Commentaire de delphiman007 le 12/02/2007 21:09:09

merci pour tous.

@+

Commentaire de bricolex le 15/10/2007 11:52:10

super utile .....
est il possible d'ajouter 2 autres sorties?
est il possible de faire l'emeteur avec un pic ?

merci encore pour cette realisation

christian

Commentaire de rylryl le 15/10/2007 14:11:09

Bonjour BRICOLEX,

Merci beaucoup, il n'est pas possible d'ajouter 2 sorties car elles sont toutes utilisées (sauf si tu n'utilise pas le LCD !! il sera alors possible de récuperer 6 sorties/entrées de plus).
Ou alors ajouter un circuit genre CD4094 par ex qui permet depuis 3 I/O du pic d'en sortir 8...

Il est bien sûr possible de faire l'emeteur... suffit de respecter les tempos et de generer les 38 ou 36 KHz...
Sans oublier bien sûr la gestion clavier !

Bonne prog ++
ryl...

Commentaire de bricolex le 16/10/2007 09:53:51

merci pour ta reponse
est il possible d'avoir un petit schema pour faire ces sorties supplementaires ainsi que la modif du fichier de programation car biensur cette application sort du projet initial
merci encore
a+
christian

Commentaire de basic12 le 09/09/2009 22:07:17

merci

Commentaire de Frudjp le 06/10/2009 16:45:13

Bonjour à tous,

Merci pour l'auteur de ce programme qui a fait un magnifique travail! Si bien que j'ai modifié à mon goût et qui bien sûr nécessite qq questions.

Voilà, j'ai viré la partie LCD et conservé uniquement le décodage du RC5. De plus j'ai modifié pour obtenir l'accès à 15 touches que je récupère en BCD sur le port B. Le capteur est déporté sur RB7. Je ne sait pas comment ont peut insérer le fichier asm mais bon je vais tenter un copier / coller sur ce post. Mais avant mes questions:

1) comment augmenter le nbre de touches, je souhaite porté à 32 touches mais impossible de valider au-delà de 15
2) J'ai pas compris ce jeu d'instruction (0x10 ^ 0x09)????? Pourtant c'est en travaillant sur cette routine que je suis arrivé à 15 touches
3) J'ai pensé modifié aussi cette cde mais ça change pas grand chose en faite j'ai valisé RB5 et RB6 en + pensant augmenter le nbre de code touche

andlw b'01111111'
andlw b'00111111'

Voici le asm modifié

ORG 0x0000


bsf STATUS,RP0 ; Select Bank 1
clrf TRISA ;
MOVLW B'10000000' ; portb.7 en entrée
MOVWF TRISB
bcf STATUS ,RP0 ; Select Bank 0
bcf INTCON, GIE ; disable Interupt


debut
call tempox

boucl_prog

clrf  PORTB
call Recv_RC5 ; Récéption d'un code RC5
movfw RC5_DATA ; si RC5_DATA =0 (touche N°0 de la TC)
btfsc STATUS,Z ;
goto    Action_1

xorlw (0x01 ^ 0x00)
btfsc STATUS,Z ;
goto    Action_2

xorlw (0x02 ^ 0x01)
btfsc STATUS,Z
goto    Action_3

xorlw (0x03 ^ 0x02)
btfsc STATUS,Z
goto    Action_4

xorlw (0x04 ^ 0x03)
btfsc STATUS,Z
goto    Action_5

xorlw (0x05 ^ 0x04)
btfsc STATUS,Z
goto    Action_6

xorlw (0x06 ^ 0x05)
btfsc STATUS,Z
goto Action_7

xorlw (0x07 ^ 0x06)
btfsc STATUS,Z
goto Action_8

xorlw (0x08 ^ 0x07)
btfsc STATUS,Z
goto Action_9

xorlw (0x09 ^ 0x08)
btfsc STATUS,Z
goto Action_10

xorlw (0x10 ^ 0x09)
btfsc STATUS,Z
goto fini

xorlw (0x11 ^ 0x10)
btfsc STATUS,Z
goto fini

xorlw (0x12 ^ 0x11)
btfsc STATUS,Z
goto fini

xorlw (0x13 ^ 0x12)
btfsc STATUS,Z
goto fini

xorlw (0x14 ^ 0x13)
btfsc STATUS,Z
goto fini

xorlw (0x15 ^ 0x14)
btfsc STATUS,Z
goto fini

xorlw (0x16 ^ 0x15)
btfsc STATUS,Z
goto fini

xorlw (0x17 ^ 0x16)
btfsc STATUS,Z
goto fini

xorlw (0x18 ^ 0x17)
btfsc STATUS,Z
goto fini

xorlw (0x19 ^ 0x18)
btfsc STATUS,Z
goto fini

xorlw (0x20 ^ 0x19)
btfsc STATUS,Z
goto Action_11

xorlw (0x21 ^ 0x20)
btfsc STATUS,Z
goto Action_12

xorlw (0x22 ^ 0x21)
btfsc STATUS,Z
goto fini

xorlw (0x23 ^ 0x22)
btfsc STATUS,Z
goto fini

xorlw (0x24 ^ 0x23)
btfsc STATUS,Z
goto fini

xorlw (0x25 ^ 0x24)
btfsc STATUS,Z
goto fini

xorlw (0x26 ^ 0x25)
btfsc STATUS,Z
goto fini

xorlw (0x27 ^ 0x26)
btfsc STATUS,Z
goto fini

xorlw (0x28 ^ 0x27)
btfsc STATUS,Z
goto fini

xorlw (0x29 ^ 0x28)
btfsc STATUS,Z
goto fini

xorlw (0x30 ^ 0x29)
btfsc STATUS,Z
goto Action_13

xorlw (0x31 ^ 0x30)
btfsc STATUS,Z
goto fini

xorlw (0x32 ^ 0x31)
btfsc STATUS,Z
goto fini

xorlw (0x33 ^ 0x32)
btfsc STATUS,Z
goto fini

xorlw (0x34 ^ 0x33)
btfsc STATUS,Z
goto fini

xorlw (0x35 ^ 0x34)
btfsc STATUS,Z
goto Action_14

xorlw (0x36 ^ 0x35)
btfsc STATUS,Z
goto Action_15

xorlw (0x37 ^ 0x36)
btfsc STATUS,Z
goto fini

xorlw (0x38 ^ 0x37)
btfsc STATUS,Z
goto fini

xorlw (0x39 ^ 0x38)
btfsc STATUS,Z
goto fini

xorlw (0x40 ^ 0x39)
btfsc STATUS,Z
goto fini

xorlw (0x41 ^ 0x40)
btfsc STATUS,Z
goto fini

xorlw (0x42 ^ 0x41)
btfsc STATUS,Z
goto fini

xorlw (0x43 ^ 0x42)
btfsc STATUS,Z
goto fini

xorlw (0x44 ^ 0x43)
btfsc STATUS,Z
goto fini

xorlw (0x45 ^ 0x44)
btfsc STATUS,Z
goto fini

xorlw (0x46 ^ 0x45)
btfsc STATUS,Z
goto fini

xorlw (0x47 ^ 0x46)
btfsc STATUS,Z
goto fini

xorlw (0x48 ^ 0x47)
btfsc STATUS,Z
goto fini

xorlw (0x49 ^ 0x48)
btfsc STATUS,Z
goto fini

xorlw (0x50 ^ 0x49)
btfsc STATUS,Z
goto fini

xorlw (0x51 ^ 0x50)
btfsc STATUS,Z
goto fini

xorlw (0x52 ^ 0x51)
btfsc STATUS,Z
goto fini

xorlw (0x53 ^ 0x52)
btfsc STATUS,Z
goto fini

xorlw (0x54 ^ 0x53)
btfsc STATUS,Z
goto fini

xorlw (0x55 ^ 0x54)
btfsc STATUS,Z
goto fini

xorlw (0x56 ^ 0x55)
btfsc STATUS,Z
goto fini

xorlw (0x57 ^ 0x56)
btfsc STATUS,Z
goto fini

xorlw (0x58 ^ 0x57)
btfsc STATUS,Z
goto fini

xorlw (0x59 ^ 0x58)
btfsc STATUS,Z
goto fini

xorlw (0x60 ^ 0x59)
btfsc STATUS,Z
goto fini

xorlw (0x61 ^ 0x60)
btfsc STATUS,Z
goto fini

xorlw (0x62 ^ 0x61)
btfsc STATUS,Z
goto fini

xorlw (0x63 ^ 0x62)
btfsc STATUS,Z
goto fini

xorlw (0x64 ^ 0x63)
btfsc STATUS,Z
goto fini

xorlw (0x65 ^ 0x64)
btfsc STATUS,Z
goto fini

xorlw (0x66 ^ 0x65)
btfsc STATUS,Z
goto fini

xorlw (0x67 ^ 0x66)
btfsc STATUS,Z
goto fini

xorlw (0x68 ^ 0x67)
btfsc STATUS,Z
goto fini

xorlw (0x69 ^ 0x68)
btfsc STATUS,Z
goto fini

xorlw (0x70 ^ 0x69)
btfsc STATUS,Z
goto fini

xorlw (0x71 ^ 0x70)
btfsc STATUS,Z
goto fini

xorlw (0x72 ^ 0x71)
btfsc STATUS,Z
goto fini

xorlw (0x73 ^ 0x72)
btfsc STATUS,Z
goto fini

xorlw (0x74 ^ 0x73)
btfsc STATUS,Z
goto fini

xorlw (0x75 ^ 0x74)
btfsc STATUS,Z
goto fini

xorlw (0x76 ^ 0x75)
btfsc STATUS,Z
goto fini

xorlw (0x77 ^ 0x76)
btfsc STATUS,Z
goto fini

xorlw (0x78 ^ 0x77)
btfsc STATUS,Z
goto fini

xorlw (0x79 ^ 0x78)
btfsc STATUS,Z
goto fini

xorlw (0x80 ^ 0x79)
btfsc STATUS,Z
goto fini

xorlw (0x81 ^ 0x80)
btfsc STATUS,Z
goto fini

xorlw (0x82 ^ 0x81)
btfsc STATUS,Z
goto fini

xorlw (0x83 ^ 0x82)
btfsc STATUS,Z
goto fini

xorlw (0x84 ^ 0x83)
btfsc STATUS,Z
goto fini

xorlw (0x85 ^ 0x84)
btfsc STATUS,Z
goto fini

xorlw (0x86 ^ 0x85)
btfsc STATUS,Z
goto fini

xorlw (0x87 ^ 0x86)
btfsc STATUS,Z
goto fini

xorlw (0x88 ^ 0x87)
btfsc STATUS,Z
goto fini

xorlw (0x89 ^ 0x88)
btfsc STATUS,Z
goto fini

xorlw (0x90 ^ 0x89)
btfsc STATUS,Z
goto fini

xorlw (0x91 ^ 0x90)
btfsc STATUS,Z
goto fini

xorlw (0x92 ^ 0x91) ; si RC5_DATA =h0C (touche ON/OFF de la TC)
btfsc STATUS,Z
goto fini

xorlw (0x93 ^ 0x92)
btfsc STATUS,Z
goto fini

xorlw (0x94 ^ 0x93)
btfsc STATUS,Z
goto fini

goto fini

;-----------------------------------Validation des sorties-----------------------------------

Action_1
movlw   B'00001010' ; Touche 0
movwf   PORTB
goto fini
Action_2
movlw   B'00000001' ; Touche 1
movwf   PORTB
goto fini
Action_3
movlw   B'00000010' ; Touche 2
movwf   PORTB
goto fini
Action_4
movlw   B'00000011' ; Touche 3
movwf   PORTB
goto fini
Action_5
movlw   B'00000100' ; Touche 4
movwf   PORTB
goto fini
Action_6
movlw   B'00000101' ; Touche 5
movwf   PORTB
goto fini
Action_7
movlw   B'00000110' ; Touche 6
movwf   PORTB
goto fini
Action_8
movlw   B'00000111' ; Touche 7
movwf   PORTB
goto fini
Action_9
movlw   B'00001000' ; Touche 8
movwf   PORTB
goto fini
Action_10
movlw   B'00001001' ; Touche 9
movwf   PORTB
goto fini
Action_11
movlw   B'00001011' ; Touche Next
movwf   PORTB
goto fini
Action_12
movlw   B'00001100'   ; Touche Previous
movwf   PORTB
goto fini

Action_13
movlw   B'00001101' ; Touche Pause
movwf   PORTB
goto fini
Action_14
movlw   B'00001110' ; Touche Play
movwf   PORTB
goto fini
Action_15
movlw   B'00001111'   ; Touche Stop
movwf   PORTB
goto fini




Action_16
movlw   B'00010000' ; Touche
movwf   PORTB
goto fini
Action_17
movlw   B'00010001'   ; Touche
movwf   PORTB
goto fini

Action_18
movlw   B'00010010' ; Touche
movwf   PORTB
goto fini
Action_19
movlw   B'00010011' ; Touche
movwf   PORTB
goto fini
Action_20
movlw   B'00010100'   ; Touche
movwf   PORTB
goto fini

Action_21
movlw   B'00010101' ; Touche
movwf   PORTB
goto fini
Action_22
movlw   B'00010110'   ; Touche
movwf   PORTB
goto fini

Action_23
movlw   B'00010111' ; Touche
movwf   PORTB
goto fini
Action_24
movlw   B'00011000' ; Touche
movwf   PORTB
goto fini
Action_25
movlw   B'00011001'   ; Touche
movwf   PORTB
goto fini




Action_26
movlw   B'00011010' ; Touche
movwf   PORTB
goto fini
Action_27
movlw   B'00011011'   ; Touche
movwf   PORTB
goto fini

Action_28
movlw   B'00011100' ; Touche
movwf   PORTB
goto fini
Action_29
movlw   B'00011101' ; Touche
movwf   PORTB
goto fini
Action_30
movlw   B'00011110'   ; Touche
movwf   PORTB
goto fini

Action_31
movlw   B'00011111'   ; Touche
movwf   PORTB
goto fini

fini
call tempox ; tempo entre chaque detection
call tempox

goto boucl_prog ; recommencer la detection RC5



;-----------------------------------Tempo 500µS-----------------------------------

busy movwf NB_TEMPO ; Temporisation : dure 500µs x "la valeur contenue dans W"
boucle movlw .123
movwf BUSY_1
boucle1 NOP
decfsz BUSY_1,1
goto boucle1
decfsz NB_TEMPO,1
goto boucle
return   ; retour de la sous-routine
;-----------------------------------Tempo XXµS-----------------------------------

tempox   movlw 0x0B ; pour x boucles
tempoxx movwf cmpt1 ; dans cmpt1
boucle2         movlw 0x25
call busy         ; TEMPO xxxx µS
     decfsz cmpt1 , f   ; si 0, décrémenter compteur 3
   goto boucle2 ; si cmpt1 pas 0, recommencer boucle2
   return     ; retour de la sous-routine

;-----------------------------------Réception des codes IR-----------------------------------
; RECEPTION D'UN CODE RC5
; RB6 en entrée (TSOP 1738...ou equivalent infra rouge)
; Controle RC5 : RC5_CTRL => 1 bit
; Adresse RC5 : RC5_ADR => 5 bits
; Données RC5   : RC5_DATA => 6 bits

Recv_RC5
btfsc PORTB, 7 ; Attendre un "0"
goto Recv_RC5 ; du bit de start

call Tempo444 ; attendre 444us, 1/4 cycle pour capture bit a bit

btfsc PORTB, 7 ; tester si "0" (anormal probabl... une emission en cours mal sync!)
goto Fin_RC5 ; ERREUR ! finir la phase de reception

clrf donn1 ; donn1=0
clrf donn2 ; donn2=0
movlw .13 ; 13 bits a capturer
movwf Loop3 ; 12 sont traites

call Tempo888 ; 1/4 du 2' Bit

nextbit         rlf donn1,f ; rotation a gauche de tous les bits
rlf donn2,f ;
bcf donn1, 0 ; forcer a "0" le bit0 de "donn1"
btfsc PORTB, 7 ; si RB6 (infra rouge) =0
bsf donn1, 0 ; forcer a "1" le bit0 de "donn1"

call Set_bit ; attendre flanc montant ou desc en fonction de l'etat de RB6 (infra rouge)

call Tempo444 ; attendre 3/4 de Bit pour se ;tempo ; = 444,5 us
call Tempo888 ; placer a 1/4 du bit suivant ;tempo ; = 889 us
decfsz Loop3,f ; les 13 bits sont t-ils tous reçus
goto nextbit ; si non, recommencer reception du bit suivant

;Recuperation des bits du code RC5 des variables "donn1" "donn2"

movfw donn1 ; recuperation des 6 bits de Données RC5
andlw b'01111111' ; 0 sur les bits non utilisés
movwf RC5_DATA ; Placer val dans "RC5_DATA"

rlf donn1,f ; decalage a gauche de 2
rlf donn2,f ; pour faire "remonter" les bits
rlf donn1,f ; de l'Adresse RC5
rlf donn2,f ; de donn1
movfw donn2 ; vers donn2
andlw b'00111111' ; 0 sur les bits non utilisés
movwf RC5_ADR ; recuperation des 5 bits dans "RC5_ADR"

clrf RC5_CTRL ; recuperation du bit
btfss donn2, 5 ; de controle RC5
bsf RC5_CTRL, 0 ; dans "RC5_CTRL"
Fin_RC5
return


;-------------------------Attendre fin bit fonction de PORTB6 (IR)-----------------------------

Set_bit movlw 0x09 ; Tempo
movwf Loop1
tim11 movlw 0x20 ;
movwf Loop2
tim22 decfsz Loop2,f
goto tim22

btfsc PORTB, 7 ; si "0"
goto haut
bas btfsc donn1, 0 ; bit en cours =0 ?
return ; flanc haut/bas
goto saut_l
haut btfss donn1, 0 ; bit en cours =1 ?
return ; flanc bas/haut
saut_l decfsz Loop1,f
goto tim11
return


;--------------------------------------- TEMPORISATION POUR RC5--------------------------------------

Tempo888 movlw 0x12 ; Temporisation de 888µs
goto tim0

Tempo444 movlw 0x09 ; Temporisation de 444µs
tim0 movwf Loop1
tim1 movlw 0x0F
movwf Loop2
tim2 decfsz Loop2,f
goto tim2

decfsz Loop1,f
goto tim1
return



end

============================

Merci à tous

Cdlt,

Commentaire de Frudjp le 06/10/2009 16:50:41

Oublier d'ajouter une petite précision

Ce prg fonctionne avec les télécommandes suivantes:

Marantz (lecteur CD7001)
Cyrrus  CD système
Philips RD6830
+ télécommande universelle programmable

Merci

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,671 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales