
digital value    binary value    Corresponding Hexadecimal value
                (actually P3)          (value assigned to
                                        8051 via C Language)
0                 00000000                      00
17                00010001                      11
64                01000000                      40
128               10000000                      80
192               110000000                     C0
238               11101110                      EE
255               11111111                      FF
238               11101110                      EE
192               110000000                     C0
128               10000000                      80
64                01000000                      40
17                00010001                      11

YOu can see that it is a crude sine wave.. slightly distorted..
The 00000000 assigned to P3 will keep LED off. 00010001 will on it. 01000000 will on it with more intensity as P3^2 has more priority that P3^3 + P3^8. and so on. Thus intensity is controlled.
this is my C code compiled on KEIL with no errors and warnings and HEX file created successfullly on Proteus.

<pre>
#include <reg52.h>
#define SIZE 12

void wait(void)
{
   int x;
   for( x = 0; x <= 32700; x++ );
}
void main(void)
{
   unsigned long crude[SIZE] = { 0x00, 0x11, 0x40, 0x80,
    0xC0, 0xEE, 0xFF, 0xEE, 0xC0, 0x80, 0x40, 0x11 };
   int i;
   for( ; ; )
   {
      for( i = 0; i < SIZE; i++ )
	  {
	     P1 = crude[i];
		 wait();
	  }
	}
}
