WOW !! MUCH LOVE ! SO WORLD PEACE !
Fond bitcoin pour l'amélioration du site: 1memzGeKS7CB3ECNkzSn2qHwxU6NZoJ8o
  Dogecoin (tips/pourboires): DCLoo9Dd4qECqpMLurdgGnaoqbftj16Nvp


Home | Publier un mémoire | Une page au hasard

 > 

Récepteur ir/pc 16 canaux

( Télécharger le fichier original )
par Hervé Walter FOPA TEDONGMO
Ecole normale supérieure d'enseignement technique de Douala ( ENSET) - DIPET 2 2009
  

précédent sommaire suivant

Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy

IV.1.3 Code source

Ecrit en langage BASIC à l'aide du logiciel PROTON, le programme du microcontrôleur se présente comme suit :

Device = 16F877

XTAL 4

ALL_DIGITAL = TRUE

Symbol entreeIR = PORTA.0

Symbol entreeSW1 = PORTA.1

Symbol entreeSW2 = PORTA.2

Symbol entreeSW3 = PORTA.3

Symbol entreeSW4= PORTA.4

Symbol sortieLIR = PORTA.5

Symbol sortie0 = PORTC.0

Symbol sortie1 = PORTC.1

Symbol sortie2 = PORTC.2

Symbol sortie3 = PORTC.3

Symbol sortie4 = PORTC.4

Symbol sortie5 = PORTC.5

Symbol TXData = PORTC.6

Symbol RXData = PORTC.7

Symbol sortie6 = PORTE.0

Symbol sortie7 = PORTE.1

Symbol sortieLENG = PORTE.2

Symbol sortie8 = PORTD.0

Symbol sortie9 = PORTD.1

Symbol sortie10 = PORTD.2

Symbol sortie11 = PORTD.3

Symbol sortie12 = PORTD.4

Symbol sortie13 = PORTD.5

Symbol sortie14 = PORTD.6

Symbol sortie15 = PORTD.7

Symbol entree0 = PORTB.0

Symbol entree1 = PORTB.1

Symbol entree2 = PORTB.2

Symbol entree3 = PORTB.3

Symbol entree4 = PORTB.4

Symbol entree5 = PORTB.5

Symbol entree6 = PORTB.6

Symbol entree7 = PORTB.7

Dim ADREEPROM As Byte

Dim ADR_IR As Byte

Dim COM_IR As Byte

Dim compt_ADRAs Byte

Dim compt_COMAs Byte

Dim erreurAs Byte

Dim TAMPON_ADR As Byte

Dim TAMPON_ADR1 As Byte

Dim TAMPON_ADR2 As Byte

Dim TAMPON_ENT As Byte

Dim comptAs Byte

Dim TAMPON As Bit

Dim bon_codeAs Bit

Dim Mo_sortiesG1 As Byte

Dim Mo_sortiesG2 As Byte

Dim code1 As Byte

Dim octet1 As Byte

Dim octet2 As Byte

Dim octet3 As Byte

Dim vitesseAs Byte

RCSTA = %10010000 ' Enable serial continuous receive

TXSTA = %00100000 ' Enable transmit asynchronous mode

TAMPON_ADR1 = EReadADREEPROM + 3

If TAMPON_ADR1 <> 6 Or TAMPON_ADR1 <> 25 Or TAMPON_ADR1 <> 51 Or TAMPON_ADR1 <> 2 Then

vitesse = 6

SPBRG = 6

Else

vitesse = TAMPON_ADR1

SPBRG = TAMPON_ADR1

EndIf

Mo_sortiesG1 = EReadADREEPROM + 1

Mo_sortiesG2 = EReadADREEPROM + 2

OPTION_REG.7=0

Input PORTB

Output PORTD

Output PORTE

TRISA=%11011111

TRISC=%10000000 ' Set TX (PortC.6) to output

ADREEPROM = 0

ADR_IR = 0

COM_IR = 0

sortie0 = 0

sortie1 = 0

sortie2 = 0

sortie3 = 0

sortie4 = 0

sortie5 = 0

sortie6 = 0

sortie7 = 0

sortie8 = 0

sortie9 = 0

sortie10 = 0

sortie11 = 0

sortie12 = 0

sortie13 = 0

sortie14 = 0

sortie15 = 0

sortieLIR = 0

sortieLENG = 0

debut:

If entreeSW1=0 Then GoSubMo_infrarouge

If entreeSW1=1 Then GoSubMo_PC

GoTodebut

Mo_infrarouge:

If entreeSW1 = 0 AndentreeSW2 = 0 Then GoSubMo_IR_ENG

If entreeSW1 = 0 AndentreeSW2 = 1 Then GoSubMo_IR_NORM

Return

Mo_IR_ENG:

If entreeSW1 = 0 AndentreeSW2 = 0 And entreeIR = 0 Then

sortieLIR = 1

GoSubLECTURE

GoSubTRAME

sortieLIR = 0

GoSubENREGIS_ADR

EndIf

Return

Mo_IR_NORM:

If entreeSW1 = 0 AndentreeSW2 = 1 And entreeIR = 0 Then

GoSubLECTURE

GoSubACTION

If bon_code = 1 Then

sortieLIR = 1

GoSubTRAME

GoSubFIN_TRAME

sortieLIR = 0

EndIf

EndIf

Return

Mo_PC:

If entreeSW2 = 0 Then

GoSubMo_PC_ENG

Else

HSerIn10 , Timeout , [code1]

GoSubaction_donnees

End If

Timeout:

Return

Mo_PC_ENG:

If entreeSW3 = 0 AndentreeSW4 = 0 Then

vitesse = 25 '2400 Mb/s

SPBRG = 25

GoSubENREGIS_vitesse

EndIf

If entreeSW3 = 0 AndentreeSW4 = 1 Then

vitesse = 6 '9600 Mb/s

SPBRG = 6

GoSubENREGIS_vitesse

EndIf

If entreeSW3 = 1 AndentreeSW4 = 0 Then

vitesse = 51 '1200 Mb/s

SPBRG = 51

GoSubENREGIS_vitesse

EndIf

If entreeSW3 = 1 AndentreeSW4 = 1 Then

vitesse = 2 '19200 Mb/s

SPBRG = 2

GoSubENREGIS_vitesse

EndIf Return

précédent sommaire suivant






Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy








"Le don sans la technique n'est qu'une maladie"