; CHRONO AU 1/100 EME DE SECONDE.
; COMMANDE PAR POUSSOIR OU PAR TOP RADIO
; MM 15/08/2014
; gestion Afficheur par CD4543
;
#picaxe 28X2
setfreq M16
dirsB=%11111111 ;broches B en sorties pour les codes chiffres
dirsA=%11111 ;Pour les pulses LD sur les CD4543
;hsersetup B4800_16, %10 ; 4800 baud, inverted TXD pour afficheur led perso
hsersetup B2400_16, %10 ; 2400 baud, inverted TXD pour afficheur OLED 133Y
symbol depart=pinC.1 ;sur sortie Départ du 14M2 ou manuel. pinC.1=0 si Appuyé
symbol Arrive=pinC.2 ;Sur sortie Arrivée du 14M2 ou manuel pinC.2=0 si Appuyé
symbol RAZ =pinC.3 ;Sur sortie RAZ du 14M2 ou manuel pinC.3=0 si Appuyé
symbol LCD =C.6 ;sortie Hserout
symbol chiffr=b6
symbol digit=b7
symbol val=w13
;calibfreq 0 ;à modifier pour calibration horloge: +X pour accélérer; -X pour ralenir
settimer 64911 ;reglage timer 1/100 s (voir doc)
pause 500 ;pause initialisation LCD
hserout LCD,(254,1) ;raz affichage LCD
hserout LCD,(254,128," CHRONO AGILITY ") ;affichage LCD
Do
val=0
do ;Attente top départ
gosub affich ;affiche 000,00
loop while depart=1
timer=0 ;c'est parti, RAZ timer ;
do ;boucle chrono
val=timer ;lecture temps
gosub affich ;affichage temps
if arrive=0 then exit ;attente arrivée
loop
do ;Attente RAZ
gosub affich ;affichage dernière valeur
loop while RAZ=1 and depart=1
loop
affich:
bintoascii val, b1,b2,b3,b4,b5 ;décomposition asci i
hserout LCD,(254,196,b1,b2,b3,",",b4,b5," s") ;affichage LCD
digit=%01111 ;sortie A.4 =0 ; donne 1 en sortie du ULN2803
chiffr=b5-48 ;centièmes
gosub affchif ;affichage chiffre
digit=%10111 ;A.3=0
chiffr=b4-48 ;dizièmes
gosub affchif
digit=%11011
chiffr=b3-48 ;unité secondes
gosub affchif
digit=%11101 ;dizaines sec
chiffr=b2-48
gosub affchif
digit=%11110 ;centaines sec
chiffr=b1-48
gosub affchif
return
affchif:
pinsB=chiffr ;chiffre en BCD sur port B
pinsA=digit ;selection digit ;pulse LD sur port A
[COLOR="#FF0000"] pause 1 ;modif temps impulsion de validation [/COLOR]
pinsA=%11111 ;toutes les sorties de l'ULN2803 à 0
return