From 479f270bb72961a4d2b6d5b9c51bafc815cbf122 Mon Sep 17 00:00:00 2001 From: dalmais Date: Tue, 19 Apr 2005 20:20:09 +0000 Subject: la tourelle marche test des sharps. --- n/es/src/tourelle.c | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) (limited to 'n/es/src/tourelle.c') diff --git a/n/es/src/tourelle.c b/n/es/src/tourelle.c index 7d07298..62f037f 100644 --- a/n/es/src/tourelle.c +++ b/n/es/src/tourelle.c @@ -28,7 +28,7 @@ const uint8_t delayMax = 125; const uint8_t delayMin = 175; const uint8_t pin_sharp = 3 ; uint8_t delay = 0; -const uint8_t SEUIL = 180; // 10 cm = 2.25V et 80 cm = 1.75 V +const uint8_t SEUIL = 280; // 10 cm = 2.25V et 80 cm = 1.75 V const uint8_t MILIEU = 2; // const int8_t PROUT = 12; A VERIFIER !! @@ -62,19 +62,33 @@ uint8_t nombre_ancien = 0; void tourelle_init (uint16_t prescaler) { - delay = 0; - DDRC = 0x80; + delay = 135; SFIOR |= 0x01; // prescaler autorisé - + + rs232_putc('T'); crenaux(delay,PORTC,7); // on met le capteur à 0° delay_ms(20L); crenaux(delay,PORTC,7); delay_ms(20L); + crenaux(delay,PORTC,7); // on met le capteur à 0° + delay_ms(20L); + DDRD = 0x80; + crenaux(delay,PORTD,7); + delay_ms(20L); + crenaux(delay,PORTD,7); + rs232_putc('C'); + + crenaux(delay,PORTC,7); // on met le capteur à 0° + delay_ms(20L); + crenaux(delay,PORTC,7); + delay_ms(20L); + rs232_putc('F'); + switch(prescaler) { @@ -110,13 +124,13 @@ void tourelle_init (uint16_t prescaler) void crenaux(uint8_t temps, uint8_t port, uint8_t pin) { uint8_t delay_crenaux = 0; - port |= _BV (pin); // en admettant que je sois sur le portb et la troisième pin + PORTD |= _BV (7); // en admettant que je sois sur le portb et la troisième pin for(delay_crenaux=0;delay_crenaux SEUIL ) { if(nombre_actuel == 0) @@ -213,6 +229,10 @@ SIGNAL (SIG_INTERRUPT1) } } + */ + + TournerTourelle (); etat = 1; + rs232_putc('4'); } -- cgit v1.2.3