PWM

What happens when i put value more than 255 in analogWrite
Ex analogWrite (led, 300);
What will the arduino read and what will the brightness of the led be ?

And what if i connected a PWM on 255 or any value value to an analog pin what will the analog pin read on serial monitor ?

You can see for your self by examining the code in wiring_analog.c. That's the beauty of the Open Source paradigm, all the code is there for you to look at.

I only gave it a very cursory look, but I'm guessing it just grabs the 8 LSBs.

The implementation is a bit weird because analogWrite() does except an int. But that value is just written to the 8-bit timer register (on an Uno). So the value is just truncated to 8-bit (aka, only the lower 8 bits are used). Effectively just looping back to 0 again. So 300 = 0b100101100 => 0b00101100 = 44.

A constrain would have been more logical in my opinion but you will have to add one yourself.

analogWrite(pin, constrain(val, 0, 255));

analogWrite(DPin, dutyCycle); function generates pre-defined PWM signals on DPins as indicated in the following diagram. Note that the argument dutyCycle is an 8-bit value. If you enter 300 (0x012C) for the variable dutyCyle, the compiler will store the lower 8-bit of 300 (0x2C = 44) into the relevant register.
pwm328.png

Now if you connect a LED at DPin-3 with a 1.5k series resistor and execute this code: analogWrite(3, 300);, the relative brightness of the LED will be 17% ((100/0xFF)*0x2C).

pwm328.png