Created
January 25, 2020 04:49
-
-
Save osamaadam/b1d299f11c91dee0c1477e69b32eba29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <reg52.h> | |
sbit errorLed = P1 ^ 0; | |
sbit initLed = P1 ^ 7; | |
sbit flashLed = P1 ^ 1; | |
bit errorSignal = 0x20 ^ 0; | |
unsigned char xdata initLoc _at_ 0x0000; | |
unsigned char xdata codeLoc _at_ 0x8000; | |
unsigned char xdata *ptr; | |
void delay(); | |
void flash(); | |
void populate(); | |
void error(); | |
void main() | |
{ | |
errorSignal = 0; | |
errorLed = 1; | |
initLed = 1; | |
flashLed = 1; | |
int i; | |
for (i = 5; i > 0; i--) | |
{ | |
flash(); | |
} | |
populate(); | |
while (1) | |
{ | |
if (errorSignal) | |
{ | |
break; | |
} | |
else | |
{ | |
flash(); | |
} | |
} | |
} | |
void delay() | |
{ | |
unsigned char i, j, k; | |
for (i = 3; i > 0; i--) | |
for (j = 255; j > 0; j--) | |
for (k = 255; k > 0; k--) | |
; | |
} | |
void flash() | |
{ | |
flashLed = flashLed ^ 0x1; | |
delay(); | |
} | |
void error() | |
{ | |
initLed = 1; | |
errorLed = 0; | |
errorSignal = 1; | |
} | |
void populate() | |
{ | |
ptr = &initLoc; | |
*ptr = 0x02; | |
ptr++; | |
*ptr = 0x08; | |
ptr++; | |
*ptr = 0x0c; | |
ptr++; | |
ptr = &codeLoc; | |
*ptr = 0xc2; | |
ptr++; | |
*ptr = 0x91; | |
ptr++; | |
*ptr = 0x12; | |
ptr++; | |
*ptr = 0x08; | |
ptr++; | |
*ptr = 0x18; | |
ptr++; | |
*ptr = 0xd2; | |
ptr++; | |
*ptr = 0x91; | |
ptr++; | |
*ptr = 0x12; | |
ptr++; | |
*ptr = 0x08; | |
ptr++; | |
*ptr = 0x18; | |
ptr++; | |
*ptr = 0x80; | |
ptr++; | |
*ptr = 0xf4; | |
ptr++; | |
*ptr = 0x78; | |
ptr++; | |
*ptr = 0x7f; | |
ptr++; | |
*ptr = 0xe4; | |
ptr++; | |
*ptr = 0xf6; | |
ptr++; | |
*ptr = 0xd8; | |
ptr++; | |
*ptr = 0xfd; | |
ptr++; | |
*ptr = 0x75; | |
ptr++; | |
*ptr = 0x81; | |
ptr++; | |
*ptr = 0x08; | |
ptr++; | |
*ptr = 0x02; | |
ptr++; | |
*ptr = 0x08; | |
ptr++; | |
*ptr = 0x00; | |
ptr++; | |
*ptr = 0x7f; | |
ptr++; | |
*ptr = 0xff; | |
ptr++; | |
*ptr = 0x7e; | |
ptr++; | |
*ptr = 0xff; | |
ptr++; | |
*ptr = 0xde; | |
ptr++; | |
*ptr = 0xfe; | |
ptr++; | |
*ptr = 0xdf; | |
ptr++; | |
*ptr = 0xfa; | |
ptr++; | |
*ptr = 0x22; | |
ptr++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment