IC 74LS48:
The IC 74LS48 or 7448 is a simple BCD to 7 segment decoder which was used to reduce the usage of pins dedicated to the 7 segment display.It consists of 4 input pins namely 1,2,3,4 which is used to feed 4 bit data input to the IC.The fed 4 bit input binary data in turn decoded by the IC and output is obtained from the pins a, b …..f which is connected to the corresponding pins of the 7 segment display.This will display the correct digit in the 7 segment display.
DESIGN:
In the above design i have used two 7448 IC to interface two 7 segments in a single port, this will save the pin usage from the microcontroller.You can also go for direct interfacing of a 7 segment with a dedicated port if you don't have 7448 IC in your possession.
Interrupt 0 feature of the Microcontroller was used here, therefore a simple push button was interfaced with the pin INT0 pin of the 8051 controller.Reset button was used with the pin 9 to reset the operation and start running the program from the beginning.
NUMBER GENERATION PROCESS:
- Initially the number keeps running from 0 to 99 in the display at high speed in a loop, so it will barely visible to human eye.
- Pressing the interrupt button fetches the random number and displays it in the 7 segment display.
- The the reset button should be pressed to initialize the program and counting again.
CODE:
#includeint a,b!void delay()!void main() { IE=0x81; //External interrupt activation while(1) { for(a=0;a<=9;a++) //Number generation { for(b=0;b<=9;b++) { P2=a|b<<4!delay()!} } } } void delay() { int i!for(i=0;i<=400;i++)!} void extr0(void) interrupt 0 //Subroutine EX0 with interrupt number '0' { P2=a|b<<4; while(1)!}
NOTE:
- Resistors for 7 segment are omitted for the simplicity of the schematic diagram, hook up a 470 ohm resistor to each pins connecting from 74LS48 to 7 segment pins.
without reset the 8051 can we change the number ??what is change in code if..once a number was displayed than that number will display after 99 time later…or if we reset the controller…plz tell me