dujardin stephane / Mbed 2 deprecated base_mbed_SAE1_S2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sousprog.h Source File

sousprog.h

00001 
00002 //  sous programmes de gestion technique de la carte micro
00003 
00004 void interrupt()// à chaque carractère reçut,  ce programme est activé
00005     {  // 
00006     recpt =  pc.getc();  
00007     if ( recpt == 'l') LED = 1 ; //allumer   LED 
00008     if ( recpt == 'k') LED = 0 ; //eteindre  LED 
00009     
00010     // augmenter ou baisser Vr ( compensation en température)  
00011     if ( recpt == 'r') {Vr = Vr - 0.02  ; if ( Vr < 0.05) Vr = 0.06;outVr.write(Vr) ; } //--
00012     if ( recpt == 'm') {Vr = Vr - 0.001 ; if ( Vr < 0.05) Vr = 0.06;outVr.write(Vr) ; } // -
00013     if ( recpt == 's')  Vr = 0.3681 ;                               //vK remis à 20°C (environ )
00014     if ( recpt == 'p') {Vr = Vr + 0.001 ; if ( Vr > 0.95) Vr = 0.94;outVr.write(Vr) ; } // +
00015     if ( recpt == 'q') {Vr = Vr + 0.02  ; if ( Vr > 0.95) Vr = 0.94;outVr.write(Vr) ; } // ++
00016     return;  // fin du sous programme 
00017     }
00018     
00019 void init(void)    // initialisations hard  
00020     {
00021     pc.baud(115200);     // vitesse liaison série
00022     pc.attach(&interrupt, Serial::RxIrq);  // autorise IT de liaison serie 
00023     plus = 1;            // polarisation de la résistance de l'inter carte
00024     LED = 0 ;            // led carte  off
00025     outVr.write(Vr);     // sortie de  outVr sur la broche  vK   
00026     pc.putc('h')   ;     // dit au PC  pas de carte capteur
00027     }