cmos to optocoupler?

You should supply a schematic of your circuit for a better chance to get help, but from your description I would suspect that the 4040 is not able to supply the current needed by your configuration of the optocoupler. IE, what resistor are you using to limit current drawn by the optocoupler?