TP 1 Prise en main

TP 1 Prise en main TP 1 Prise en main

moutou.pagesperso.orange.fr
from moutou.pagesperso.orange.fr More from this publisher
13.07.2015 Views

TP -II2 Programmation C sur PIC avec EasyPIC5 et MikroC (IUT Troyes)S. Moutou et F. Morain-Nicolier20 PORTA = 0; // Turn off all 7seg displays21 PORTD = mask(cmpt % 10); // bring appropriate value to PORTD22 PORTA = 1; // turn on appropriate 7seg. display23 Delay_ms(10);24 //dizaines25 PORTA = 0; // Turn off all 7seg displays26 PORTD = mask((cmpt / 10)%10); // bring appropriate value to PORTD27 PORTA = 2; // turn on appropriate 7seg. display28 Delay_ms(10);29 //centaines30 PORTA = 0; // Turn off all 7seg displays31 PORTD = mask((cmpt / 100)%10); // bring appropriate value to PORTD32 PORTA = 4; // turn on appropriate 7seg. display33 Delay_ms(10);34 }35 } while (1); //endless loop36 }Il manque le test de dépassement des centaines !Exercice 5-1 :Correction TP51 void main (){2 unsigned int temp;3 my_glcd_init ();4 while (1) {5 // Step a)6 Ow_Reset (&PORTE,2); // ou : Ow_Reset (&PORTA,5); suivant switch J1122/22 Réalisé avec OpenOffice sous Linux

<strong>TP</strong> -II2 Programmation C sur PIC avec EasyPIC5 et MikroC (IUT Troyes)S. Moutou et F. Morain-Nicolier20 PORTA = 0; // Turn off all 7seg displays21 PORTD = mask(cmpt % 10); // bring appropriate value to PORTD22 PORTA = 1; // turn on appropriate 7seg. display23 Delay_ms(10);24 //dizaines25 PORTA = 0; // Turn off all 7seg displays26 PORTD = mask((cmpt / 10)%10); // bring appropriate value to PORTD27 PORTA = 2; // turn on appropriate 7seg. display28 Delay_ms(10);29 //c<strong>en</strong>taines30 PORTA = 0; // Turn off all 7seg displays31 PORTD = mask((cmpt / 100)%10); // bring appropriate value to PORTD32 PORTA = 4; // turn on appropriate 7seg. display33 Delay_ms(10);34 }35 } while (1); //<strong>en</strong>dless loop36 }Il manque le test de dépassem<strong>en</strong>t des c<strong>en</strong>taines !Exercice 5-1 :Correction <strong>TP</strong>51 void <strong>main</strong> (){2 unsigned int temp;3 my_glcd_init ();4 while (1) {5 // Step a)6 Ow_Reset (&PORTE,2); // ou : Ow_Reset (&PORTA,5); suivant switch J1122/22 Réalisé avec Op<strong>en</strong>Office sous Linux

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!