Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
digital dice 8051 microcontroller hex code
#1

ej:020000040000FA
:200000000202B17F167E00EF4E7039EF64014E7033EF64024E702DEF64034E7027EF64041B
:200020004E7021EF64054E701BEF64064E7015EF64074E700FEF64084E7009EF64094E7021
:200040000302011AC290D291D292D29320941020900D7F3112053F7590FF7E007F01222037
:20006000951020900D7F3212053F7590FF7E007F022220961020900D7F3312053F7590FF63
:200080007E007F032220971020900D7F3412053F7590FF7E007F0422D290C291D292D2930C
:2000A00020941020910D7F3512053F7590FF7E007F052220951020910D7F3612053F7590F9
:2000C000FF7E007F062220961020910D7F3712053F7590FF7E007F072220971020910D7F3E
:2000E0003812053F7590FF7E007F0822D290D291C292D29320941020920D7F3912053F75C3
:2001000090FF7E007F09223095030200073092030200077F3012053F80007590FFE4FEFF1F
:200120002212056B741F2510F8E6FF600D1205A40510E51070EE050F80EAE4F50FF5107FFC
:20014000C8120572E5106402450F6019120003E51025E0243DF8A60608A6070510E51070E3
:20016000E3050F80DFAE3DAF3E7C007D0A1203ACE5402FF52EE53F3EF52D1205667411256B
:2001800010F8E6FF600D1205A40510E51070EE050F80EAE4F50FF5107FC8120572E510644E
:2001A00002450F6019120003E51025E0243BF8A60608A6070510E51070E3050F80DFAE3BF0
:2001C000AF3C7C007D0A1203ACE53E2FF530E53D3EF52FE4F50FF5107F107E271205467F78
:2001E000011205727F8002057212056674312510F8E6FF600D1205A40510E51070EE050F25
:2002000080EAE4F50FF5107F8912057274082510F8E6FF600D1205A40510E51070EE050FC4
:2002200080EAE4F50FF510E52E640C452D702BC3E530943CE52F64809480401EE53A943CD6
:20024000E539648094804012753900753A01752D00752E01752F00753001C3E530943CE5BB
:200260002F648094804014052EE52E7002052D752F00753001753900753A01C3E53A943CBF
:20028000E53964809480400E0530E5307002052F753900753A011205127F3A1205A4AF3030
:2002A000AE2F12051B7FCB120572AF3AAE3902051B787FE4F6D8FD7581440202F80205B6D1
:2002C000E493A3F8E493A34003F68001F208DFF48029E493A3F85407240CC8C333C4540F40
:2002E0004420C8834004F456800146F6DFE4800B01020408102040809004D6E47E019360F7
:20030000BCA3FF543F30E509541FFEE493A360010ECF54C025E060A840B8E493A3FAE49361
:20032000A3F8E493A3C8C582C8CAC583CAF0A3C8C582C8CAC583CADFE9DEE780BEE4F53F2C
:20034000F540753900753A02E4F541F542E4F53FF540758901758CF8758ACCD28C308DFD90
:20036000C28CC28D0540E5407002053FB4F4E3E53FB401DE053AE53A700205397FCB12050F
:2003800072AF3AAE3912051B120584EF64014E700512041380AC0542E54270020541C39465
:2003A0003BE5416480948040A40201E9EF8DF0A4A8F0CF8CF0A428CE8DF0A42EFE22BC005C
:2003C0000BBE0029EF8DF084FFADF022E4CCF875F008EF2FFEE33FEEC33FCEE9DEC9840C2
:2003E00005FCEE9DFE0FD5F0E9E4CEFD22EDF8F5F0EE8420D21CFEADF075F008EF2FFED89
:2004000033FD4007985006D5F0F222C398FD0FD5F0EA221201217F647E00120546120566F7
:2004200074312510F8E6FF600D1205A40510E51070EE050F80EAE4F50FF5107F8912057279
:2004400074082510F8E6FF600D1205A40510E51070EE050F80EAE4F50FF5101205127F3A31
:200460001205A4AF30AE2F12051B7FCB120572AF3AAE3902051B7590FFE4F5A0F5B07F98D5
:200480007E3A12059F7F947E1112059F7F2C7E0112059F7F8A7E021205467F381205727F11
:2004A000327E001205467F0C1205727F327E001205467F011205727F327E001205467F0675
:2004C0001205727F327E001205467F801205727F327E000205460708434C4F434B21000E59
:2004E0001F484F555220303120746F203132000E114D494E5420303120746F20363000082F
:20050000315245534554203100020F000002390000007FC4120572AF2EAE2D8E438F447CE6
:20052000007D0A1203BEEF2430FF1205A4AE43AF447C007D0A1203BEED2430FF0205A412AD
:2005400005A47FA07E86E4FDFCC3ED9FEC9E5015E4FBFA0BB00010AEB64054A70F50DBD3D
:2005600000010C80E422E4F50FF5107F011205727F808FA075B0407F327E00120546C2B65B
:2005800012054622C290D291D292D2932094092090067E007F018003E4FEFF7590FF221251
:2005A00005467F308FA075B0607F327E00120546C2B61205462212047612041312033D8083
:2005C000FBFF3F
:2005E000FF1B
:20060000FFA
:20062000FFDA
:20064000FFBA
:20066000FF9A
:20068000FF7A
:2006A000FF5A
:2006C000FF3A
:2006E000FF1A
:20070000FF9
:20072000FFD9
:20074000FFB9
:20076000FF99
:20078000FF79
:2007A000FF59
:2007C000FF39
:2007E000FF19
:20080000FF8
:20082000FFD8
:20084000FFB8
:20086000FF98
:20088000FF78
:2008A000FF58
:2008C000FF38
:2008E000FF18
:20090000FF7
:20092000FFD7
:20094000FFB7
:20096000FF97
:20098000FF77
:2009A000FF57
:2009C000FF37
:2009E000FF17
:200A0000FF6
:200A2000FFD6
:200A4000FFB6
:200A6000FF96
:200A8000FF76
:200AA000FF56
:200AC000FF36
:200AE000FF16
:200B0000FF5
:200B2000FFD5
:200B4000FFB5
:200B6000FF95
:200B8000FF75
:200BA000FF55
:200BC000FF35
:200BE000FF15
:200C0000FF4
:200C2000FFD4
:200C4000FFB4
:200C6000FF94
:200C8000FF74
:200CA000FF54
:200CC000FF34
:200CE000FF14
:200D0000FF3
:200D2000FFD3
:200D4000FFB3
:200D6000FF93
:200D8000FF73
:200DA000FF53
:200DC000FF33
:200DE000FF13
:200E0000FF2
:200E2000FFD2
:200E4000FFB2
:200E6000FF92
:200E8000FF72
:200EA000FF52
:200EC000FF32
:200EE000FF12
:200F0000FF1
:200F2000FFD1
:200F4000FFB1
:200F6000FF91
:200F8000FF71
:200FA000FF51
:200FC000FF31
:200FE000FF11
:00000001FF
Reply

#2
digital dice 8051 microcontroller hex code

It s an Electronic Dice Game using 8051 microcontroller. It is an interesting and basic learning project for student and hobbies. It describes how can we interface 8051 port pins for input and output.

Detail

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



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.