The document describes different methods for converting a decimal number to binary-coded decimal (BCD) format. It discusses:
1) Defining the decimal to BCD conversion function and providing truth tables and logic equations.
2) Using an integrated circuit chip (74LS147) that prioritizes the decimal input and outputs the corresponding 4-bit BCD code.
3) Implementing the conversion using a microcontroller programmed algorithm that reads switch states and outputs the BCD value.
The document describes different methods for converting a decimal number to binary-coded decimal (BCD) format. It discusses:
1) Defining the decimal to BCD conversion function and providing truth tables and logic equations.
2) Using an integrated circuit chip (74LS147) that prioritizes the decimal input and outputs the corresponding 4-bit BCD code.
3) Implementing the conversion using a microcontroller programmed algorithm that reads switch states and outputs the BCD value.
The document describes different methods for converting a decimal number to binary-coded decimal (BCD) format. It discusses:
1) Defining the decimal to BCD conversion function and providing truth tables and logic equations.
2) Using an integrated circuit chip (74LS147) that prioritizes the decimal input and outputs the corresponding 4-bit BCD code.
3) Implementing the conversion using a microcontroller programmed algorithm that reads switch states and outputs the BCD value.
I. Définition La fonction codage décimal / BCD consiste à convertir chaque chiffre d’un nombre décimal (N)10 en binaire dans un formant de 4 bits chacun. Le résultat obtenu est (N)BCD. I.1. Modélisation et table de vérité La fonction codage est matérialisée par un montage électronique qui reçoit en entrée 10 variables et fourni en sortie le résultat dans un format de 4 bits (D, C, B, A). La figure 1 représente la modélisation et la table de vérité.
Le circuit intégré 74LS147 (figure 3) est un codeur de priorité Décimal/ BCD. Il dispose de 9 entrées et quatre sorties produisant 10 codes BCD. Ses entrées et ses sorties sont complémentés. Il est dit de priorité car en cas où plusieurs entrées sont simultanément actives, c’est l’entrée de plus fort poids qui l’emporte.
Fig. 3
II.1. Extrait du document technique
La figure 4 représente un extrait du document technique du circuit intégré 74147. Fig. 4
Plus d’information dans la datasheet du circuit intégré 74147.
III. Solution programmée d’un codeur Décimal BCD III.1. Schéma du circuit Le schéma du circuit (figure 5) est à base d’un microcontrôleur du type PIC16F628A. Elle illustre la fonction codage Décimal / BCD.
Fig. 5 III.2. Programme
Structure Algorithme Programme
Déclarer une variable d'entrée S1 du sbit S1 at RA4_bit; type bit branchée sur RA4. Déclaration char S2 ; Déclarer une variable S2 du type byte. DEBUT void main() Mot clé du début du programme { Orientation Configurer le port A trisA = 0xF0; des ports et Configurer le port B trisB = 0xFF; initialisation Configurer le port A en numérique CMCON =0x07; des variables Initialiser S2 à 0 S2=0; de sortie TANT QUE (vraie) While (1) DÉBUT { Corps du SI portB.B7 ALORS S2 ← 9 if (portb.b7) S2 = 9 ; programme SINON SI portB.B6 ALORS S2 ← 8 else if (portb.b6) S2 = 8 ; SINON SI portB.B5 ALORS S2 ← 7 else if (portB.b5) S2 = 7 ; SINON SI portB.B4 ALORS S2 ← 6 else if (portb.b4) S2 = 6 ; SINON SI portB.B3 ALORS S2 ← 5 else if (portB.b3) S2 = 5 ; SINON SI portB.B2 ALORS S2 ← 4 else if (portb.b2) S2 = 4 ; SINON SI portB.B1 ALORS S2 ← 3 else if (portB.b1) S2 = 3 ; SINON SI portB.B0 ALORS S2 ← 2 else if (portb.b0) S2 = 2 ; SINON SI portA.A4 ALORS S2 ← 1 else if (portA.b4) S2 = 1 ; SINON S2 ← 0 else S2 = 0; PortA ← S2 portA = S2; Fin TANQUE } FIN Fin du programme }