Cours:Multimetre

De troyesGEII
Révision datée du 8 novembre 2022 à 00:33 par Bjacquot (discussion | contributions) (Programmation)
Aller à : navigation, rechercher

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