The low voltage was 3.26 volts and high was 4.32V. The high is acceptable because it was driving the optocoupler but low wasn't. The low voltage was always 3.26 V hence, static.
I'm still wondering why I got 3.26V as low.
My circuit connection was like
pin 1: Vcc(5V) via a 100E res.
pin 2: to microcontroller.
pin 3: Not connected.
pin 4: ground.
pin 5: connected to Vs(12V)via a 10k res.
pin 6: a 10k res.
from this configuration the base current should be 38.2mA. And CTR as per datasheet is above 80% for 20mA of If(emitter current),so definitely it should be over 80%. I'm driving MOSFET from optocouplers so current shouldn't be an issue 'cos MOSFETs are voltage controlled. But this configuration wasn't working. And I'm amazed why.
If possible please share a method for calculating parameters for optocoupler like how to determine the values of base resistance, emitter resistance, etc.
Thanx for the enlightening on optocoupler.