Tack för dina förslag!
I had to mix a litle from both your ideas. The sensor seems to have a really weak internal pullup to 12V so as soon as I connect the resistor divider the voltage drops alot. And without the divider the PIC gets 12V on the pin.
So I ended up introducing a new pullup resistor to 12V to the output .. and then a resistor divider from that. Weird but working


 
						
					 
			 
			 
			 
					
					

 Re: 12V PLC sensor to 3.3V input
 Re: 12V PLC sensor to 3.3V input
		 
				
				
				
				
			

Bookmarks