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/main.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'n/es/src/main.c') diff --git a/n/es/src/main.c b/n/es/src/main.c index bd2b80f..bcb123c 100644 --- a/n/es/src/main.c +++ b/n/es/src/main.c @@ -37,7 +37,7 @@ uint8_t sens = 1; // sens du scan uint8_t continu = 0; // demande fait d'un envoi en continu sur le RS232 uint8_t envoie = 0; // demande fait par I2C d'un envoi char buffer_serie ; // buffer RS232 -const uint16_t prescaler = 1024;// prescaler +const uint16_t prescaler = 8;// prescaler uint16_t tableau_longueur[25]; int main (void) @@ -47,29 +47,38 @@ int main (void) uint16_t tableau_sharp[3]; /// intialisation + DDRD = 0x80; rs232_init (); + rs232_putc('R'); twi_init (0x02); tourelle_init (prescaler); adc_init (); - sei (); + + + + sei (); // on met les interruptions - rs232_putc('I'); + rs232_putc('1'); // fin de l'initialisation /// programme principal - while(1) + while(1) // boucle principale { if(etat == 1) { - etat = 0; + rs232_putc('2'); + etat = 0; // METTRE L'ACTIVATION DE L'INTERRUPTION - TCNT1 = (65535L - ((20L*14745600L)/(1024L*1000L))); // LE PASSER EN COMPARATEUR. + TCNT1 = 5; //(65535L - ((20L*14745600L)/(1024L*1000L))); // LE PASSER EN COMPARATEUR. + if(temp_sens != sens) { + rs232_putc('S'); temp_sens = sens; // if(continu == 1) renvoi_RS232(); // nom de la fonction qui renvoie la valeur } // if(buffer_serie != 0) callback_RS232(); + TIMSK |= 0x04; } for(compteur=0;compteur<3;compteur++) @@ -78,7 +87,7 @@ int main (void) while(!adc_checkf()){} tableau_sharp[compteur]=adc_read(); } - twi_update (tableau_sharp,6); +twi_update (tableau_sharp,6); } } -- cgit v1.2.3