TPE ÉLEctronique

TEST TÉLÉCOMMANDE

voie n°1 voie n°2
gauche centre droite haut centre bas
1.2ms 1.6ms 2.0ms 1.2ms 1.6ms 2.0ms
comp 1 35 49 60 comp 2 100 137 172

Voilà ce que l'on obtient sur l'oscilloscope pour les deux voies du récepteur HF:

 

programme pour tester le RLP2002
' 24-04-02

#include "start.bas"

int k1,comp2
byte comp

    DDRD = 0             ' PD5=PD4=PD3=PD2=input
    SCONF = 0x4C             ' B,C = sorties
   

PACTL.7=0                                          'A7 en entrée
PACTL.5=1                                          'initialiser l'entrée A7 en mode timer (pmod=1)
PACTL.4=0                                          'idem (pedg=0)
PACTL.6=1                                          'validation du mode timer
TMSK2.1=0
TMSK2.4=1
TMSK2.6=0
TFLG2.6=0




cli                                                           'validation des interruptions

lcdinit()
    print " voulez vous... "


do


PACNT=0
wai
comp=PACNT

if comp2 <105 and comp >40 and comp <55 then
      gosub avancer
      tempo(10)
      gosub pon
end if


if comp2 >160 and comp >40 and comp <55 then
      gosub reculer
      tempo(10)
      gosub pon
end if
if comp2 <105 and comp <40 then
      gosub droite
      tempo(10)
       gosub pon
end if
if comp2 >160 and comp <40 then
      gosub gauche
      tempo(10)
      gosub pon
end if
if comp2 >130 and comp2 <150 then gosub poff


'    gosub test
     tempo(10)
loop

    


reculer:
PORTB.0=1
PORTB.1=1
PORTB.6=1
PORTB.7=1
return

avancer:
PORTB.0=0
PORTB.1=0
PORTB.6=0
PORTB.7=0
return

droite:
PORTB.0=1
PORTB.1=1
PORTB.6=0
PORTB.7=0
return

gauche:
PORTB.0=0
PORTB.1=0
PORTB.6=1
PORTB.7=1
return

pon:
PORTB.2=1
return

poff:
PORTB.2=0
return




function tempo(cnt)
    int i, k
    for cnt=cnt to 0 step -1
        for i=0 to 100
            k = keyget()
            if k <> 0 then putchar(k)
        next
    next
    end function

#include "lcd.bas"


interrupt function rtiint at $FFDA
comp2=0

do
      comp2=comp2+1
loop until PORTA.0=0

TFLG2=$10

end function

 

 

Page précédente Page suivante