Resistors with PN junction