Line 9: Line 9:
 
=Code=
 
=Code=
 
<html>
 
<html>
<script src="https://gist.github.com/sharanago/16048113a83ad744505631bc67fdefcc.js"></script>
+
<script src="https://gist.github.com/raghavendrahassy/ee9638f08b67bc6aee9337e6d43f5c29.js"></script>
 
</html>
 
</html>
  
 
== Demo ==
 
== Demo ==

Revision as of 17:53, 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

#include <reg51.h>
#define LED P3 // LED's are connected to higher bits of P3
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()
{
P3 = (0xf0<<LED); // Configure PORT3.4 to PORT.7 as output
while(1)
{
P3 = (0xf0<<LED); // Turn ON Led's connected to P3
DELAY_ms(1000); // Wait for some time
P3 = (0x00<<LED); // Turn OFF Led connected to P3
DELAY_ms(1000); // Wait for some time
}
return 0;
}

Demo