12v to 5v serial circuit

(deleted)

By 12v serial, do you mean RS232 voltage levels (+ and - 10~15v) or 0v/12v (which is weird)?

In that case, use something like a MAX232 - just drop it in with the capacitors as spec'ed on the datasheet, and it will shift one line in each direction for you. Doesn't even need the +/- 10v - it generates it from the 5v by cap switching (also, it's a very cheap way to get +/-10v at low current, if you need that for something. The HC-SR04 ultrasonic sensors that everyone and their mom has use a MAX232 to get the voltage to drive the transducer)

If it's actually 0v / 12v (very unlikely), serial is active low, so just use a standard bidirectional level shifter for it - you can get pre-assembled boards on ebay for dirt cheap, though they don't actually provide the specs with most of them, so you'll want to verify that they actually work with 12v on the high side side, or just make one yourself with fets you know will take the 12v. (google level shifter mosfet, go to image search and look for schematics, and click the pages for more info - there are many pages about the mosfet level shifter design, with plenty of info. It's worth looking up, and studying until you understand why it works, even if you don't plan to use it - it's a clever trick that I've used a bunch of times after finding it)

(deleted)

The 12V is a NRZ Inverted TTL 0 to +12V, not RS232.

Are you certain? NRZ means "Non Return to Zero".

This type of bi-directional level shifter should work at 12V and 5V if the 12V signal is truly positive only.

(deleted)

That link will do what you want, the code type is irrelevant.

(deleted)