Interfacing 12V logic with 5V circuitry
20Meg will only allow about 600nA of current to flow, which may not be enough to bias the input of your logic gate (check its input bias current requirements).

A quick and dirty way to do this could be to use an optocoupler, or a simple NFET that can tolerate a VGS that high. It would act as a simple inverter if your logic can tolerate that.







simulate this circuit &ndash; Schematic created using CircuitLab

For the above, I would add a protection diode to the input of the MOSFET (to clamp voltage below VGS(max)), or choose a MOSFET with a higher VGS(max). An opto has the benefit of isolating you from the higher voltage as well.