Cours:Multimetre : Différence entre versions

De troyesGEII
Aller à : navigation, rechercher
(Fonction affiche)
(Programmation)
Ligne 12 : Ligne 12 :
  
 
=Programmation=
 
=Programmation=
 +
 +
==Programmation sur tinkercad==
 +
 +
https://www.tinkercad.com/things/dSQS8on1FL6
 +
  
 
==Fonction affiche==
 
==Fonction affiche==

Version du 8 novembre 2022 à 00:33

Fichiers

Programmation

Programmation sur tinkercad

https://www.tinkercad.com/things/dSQS8on1FL6


Fonction affiche

// ! bien déclarer les broches en sorties !
void affiche7sgt(uint8_t n)
{
  PORTB=(PORTB&0xf0)|(n&0x0f);
}

// exemple d'utilisation
affiche7sgt(2);           // permettra d'afficher la valeur 2
affiche7sgt(i);           // permettra d'afficher le chiffre i (entre 0 et 9 ! )
affiche7sgt(n%10);        // permettra d'afficher la valeur des unités de n