Skip to content

Instantly share code, notes, and snippets.

@SaheblalBagwan
Last active August 27, 2016 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SaheblalBagwan/efc062c8c676a9a3575b9de450debaed to your computer and use it in GitHub Desktop.
Save SaheblalBagwan/efc062c8c676a9a3575b9de450debaed to your computer and use it in GitHub Desktop.
#include <reg51.h>
void DELAY_ms(unsigned int ms_Count)
{
unsigned int i,j;
for(i=0;i<ms_Count;i++)
{
for(j=0;j<100;j++);
}
}
int main() {
char seg_code[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
int i;
while (1)
{
for (i = 0; i <= 9; i++) // loop to display 0-9
{
P2 = seg_code[i];
DELAY_ms(1000);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment