A very simple example that toggles a set of 8 LEDs based on whether a switch is pressed or not
The switch is connected to Port 3.0, the LEDs are connected to Port 2.0 to 7.
The code was written using Keil uVision2
sbit SW1 = P3^0;
void main (void)
SW1 = 1;
P2 = 0xAA;
P2 = 0x55;