Difference between revisions of "LED Blinking with 8051 Starter Board"
Raghavendra (Talk | contribs) |
|||
Line 1: | Line 1: | ||
[[Category:Starter 8051]] | [[Category:Starter 8051]] | ||
+ | After setting up starter 8051 board, we will start with simple LED blinking experiment. On this board 4 LED's are connected to higher four bits of PORT 3. | ||
+ | We will write the code in Keil Compiler, to setting up Keil compiler for 8051 refer the [[8051_Keil_Setup|8051 Keil Setup]] tutorial. After generating the hex file refer the tutorial to [[Uploading_Hex_File_Using_nuvoTon|uploading hex file using nuvoTon]]. | ||
+ | |||
+ | ==Hookup== | ||
+ | [[]] | ||
+ | |||
=Code= | =Code= | ||
Line 5: | Line 11: | ||
<script src="https://gist.github.com/sharanago/16048113a83ad744505631bc67fdefcc.js"></script> | <script src="https://gist.github.com/sharanago/16048113a83ad744505631bc67fdefcc.js"></script> | ||
</html> | </html> | ||
+ | |||
+ | == Demo == |
Revision as of 16:14, 15 June 2016
After setting up starter 8051 board, we will start with simple LED blinking experiment. On this board 4 LED's are connected to higher four bits of PORT 3. We will write the code in Keil Compiler, to setting up Keil compiler for 8051 refer the 8051 Keil Setup tutorial. After generating the hex file refer the tutorial to uploading hex file using nuvoTon.
Hookup
[[]]
Code
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 <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() | |
{ | |
while(1) | |
{ | |
P0 = 0xff; /* Turn ON all the leds connected to Ports */ | |
P1 = 0xff; | |
P2 = 0xff; | |
P3 = 0xff; | |
DELAY_ms(500); | |
P0 = 0x00; /* Turn OFF all the leds connected to Ports */ | |
P1 = 0x00; | |
P2 = 0x00; | |
P3 = 0x00; | |
DELAY_ms(500); | |
} | |
return (0); | |
} |