The figure shows how to use a 12 V signal to trigger a TTL gate using an optical coupler. The circuit is from Radio Electronics from May 1985.