HEX to BCD Converter
This project is based on Motorola HC11 controller. This circuit is to convert hexadecimal value to BCD. The Hexadecimal value inputted to the controller using the pattern generator is converted to its corresponding BCD. To simulate this circuit, initially activate Mixed Mode simulator from the Schematic Editor window. Simulation can be performed by selecting Transient analysis from Simulation menu.
This project includes microcontroller M68HC11A8, three seven segment display units (7-Segment display and 7-Segment decoder) and a
pattern generator.
The hexadecimal value is inputted to the microcontroller using a pattern generator. The microcontroller converts the hex to corresponding BCD. This value is sent to the 7-Segment display unit which is driven by Seven segment display decoder 9368.
This device accepts a 4-bit binary code and produces output to drive the corresponding segment of the 7-segment display.
The source code written either in C or Assembly language can be vThe source code written either in C or Assembly language can be viewed from the
code editor window.
The program is as shown:> int main()
{
uint8 i, Hex, Ones, Tens, Hund, Shift;
DDRC = 0X00;
DDRD = 0XFF;
while(1)
{
Hex = PORTC;
Ones = (Hex%10);
Tens = ((Hex/10)%10);
Hund = (Hex/100);
Shift = Tens;
for(i=0;i<4;i++)
Shift = Shift<<1;
PORTB = Shift|Ones;
PORTD = Hund;
}
return(0);
}
The source code in the
code editor window
has to be
compiled
after making any modifications
(editing).
Also the code can be
debugged
during
simulation.