Skip to content

Instantly share code, notes, and snippets.

@raghavendrahassy
Created June 17, 2016 11:45
Show Gist options
  • Save raghavendrahassy/48af133158f274aee8f20e05a411a329 to your computer and use it in GitHub Desktop.
Save raghavendrahassy/48af133158f274aee8f20e05a411a329 to your computer and use it in GitHub Desktop.
Explore Starter 8051 board has 2 user interface switches on the board which are connected to P3.2 and P3.3 . There are 4 LED's are on board which are also connected to higher four bits of P3. Out of these we will read the status of SW2 ( Connected to P3.3) and will show the status on LED ( Connected to P3.7).
#include <reg51.h>
sbit LED = P3^7; // LED is connected to P3.7
sbit Switch = P3^3; // Switch is connected to P3.3
int main()
{
P3 = 0x08; // Switch declared as input and LED as output
while(1)
{
LED = Switch;
}
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment