digital dice using 8051 microcontroller at89c51
#1

being a student i need help with the project.please do send me the code for my minor project .
Reply
#2

digital dice using 8051 microcontroller at89c51

It is a project that builds microcontroller programming interest in new student and hobbies. This project is a very simple one that can easily be built by new students. It uses 7 LEDs, 8051 microcontroller and an optional 5V power supply regulator part. It’s algorithm is also very simple.
1) Initially microcontroller displays 1 on LEDs display just like in real dice.
2) Then in main while loop it waits for switch attached to pin 0 of port 1 to be pressed.
3) Until switch remains pressed it generates random number from 1 to 6 and displays it on LEDs.
4) When button is released it generates and display a new random number on LEDs.
5) It repeats from step 2 to step 5 until power is applied to the system.
For further information of components and basic 8051 microcontroller circuit please visit
8051 Basic LED Flasher.
Code

// Start of code.

///////////////////////////////////////////////////////////
// Company : Micro Digital //
// Address : Office # C7 Raza Plaza //
// DAV College Road //
// Rawalpindi, //
// Pakistan. //
// Programmed By : Rashid Mehmood //
// Project Name : Electronic Dice using 8051 //
// Crystal : 24.000000 MHz //
// Microcontroller : AT89C2051-C51-C52-C55-S2051-S51-S52 //
///////////////////////////////////////////////////////////

// Header file for AT89x051 microcontrollers regiter definitions.
#include <AT89x051.h>
// Header file for random number generation functions.
#include <stdlib.h>

sbit Led1 = P1^1;
sbit Led2 = P1^2;
sbit Led3 = P1^3;
sbit Led4 = P1^4;
sbit Led5 = P1^5;
sbit Led6 = P1^6;
sbit Led7 = P1^7;

// This function halts execution for
// specified milliseconds.
void delay_ms(unsigned int del)
{
unsigned int i,j;
for(i = 0; i < del; i ++)
for(j = 0; j < 1275; j ++);
}

// Rename or define P1.0 as Switch.
sbit Switch = P1^0;

// This function displays an integer value from
// 0 to 6 on LEDs.
void Display(char Value)
{
// Switch off all LEDs.
Led1 = Led2 = Led3 = Led4 = Led5 = Led6 = Led7 = 1;
switch(Value)
{
case 1:
Led4 = 0;
break;
case 2:
Led1 = Led7 = 0;
break;
case 3:
Led1 = Led4 = Led7 = 0;
break;
case 4:
Led1 = Led3 = Led5 = Led7 = 0;
break;
case 5:
Led1 = Led3 = Led4 = Led5 = Led7 = 0;
break;
case 6:
Led1 = Led2 = Led3 = Led5 = Led6 = Led7 = 0;
break;
}
}

// Define macro or formulae for random number
// generation from 1 to 6.
#define GetRandomNumber() ((rand() % 6) + 1)

void main()
{
char RandomNumber;
Switch = 1;
Display(1);
srand(50);
while(1)
{
// Wait until switch is pressed.
while(Switch);
// Until switch is released.
while(!Switch)
{
// Generate random number.
RandomNumber = GetRandomNumber();
// Display this number on LEDs.
Display(RandomNumber);
// Give some delay.
delay_ms(10);
}
// Generate random number last time.
RandomNumber = GetRandomNumber();
// Finally display this number on LEDs.
Display(RandomNumber);
}
}

// End of code.
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: digital dice using 8085, electronic dice project pdf, digital dice circuit using decoder 7448 ic 555 and gate nand gate and counter, advantages n disadvantages of electronic dice, how to write a report on project of electronic dice, electronic dice, advantages and dsadvantages of digital dice,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  source code for task scheduling using genetic algorithm using java 2 8,447 11-04-2017, 08:31 PM
Last Post: Guest
  source code in c for automatic irrigation system using 8051 2 962 03-08-2016, 10:53 AM
Last Post: seminar report asees
  block diagram of electronic cough monitor based on microcontroller 3 1,123 21-07-2016, 12:03 PM
Last Post: visalakshik
  smoke detector using 8051 code 2 724 15-07-2016, 03:01 PM
Last Post: jaseela123d
  abstract for speaking microcontroller for deaf and dumb pdf 2 944 14-07-2016, 12:00 PM
Last Post: jaseela123d
Wink multimedia looking towards future digital communication pdf 2 799 14-07-2016, 09:14 AM
Last Post: jaseela123d
  digital soil moisture tester project using ic lm3915 1 691 02-07-2016, 12:06 PM
Last Post: visalakshik
  c code for sending sms to gsm from 8051 controller using keil 1 698 27-06-2016, 04:34 PM
Last Post: dhanabhagya
  load flow solution using newton raphson method using pscad 1 1,504 24-06-2016, 02:53 PM
Last Post: seminar report asees
  how to stop digital electric meter with tv remote 1 1,231 24-06-2016, 10:30 AM
Last Post: seminar report asees

Forum Jump: