Electronic – How to model output pin of microcontroller in SPICE

digital-logicmsp430simulationspice

I'd like to model an output pin of a microcontroller (MSP430F5xxx) in SPICE. The datasheet contains this:

enter image description here

This is the I-V graph for a pin which is configured as output and set to logic low. There is an equivalent graph for a pin set to logic high, which is almost exactly the same shape but reversed (negative large current at V=0, zero current at V=3).

Is there a good way to reproduce this in SPICE?

Bonus question: How can this be made to produce either the logic low or logic high I-V based on an input voltage corresponding to the logic level?

Best Answer

You can model it with two customized (complementary) MOSFET models connected as a typical CMOS push-pull output.

Here is a link to a video How to model a MOSFET using a Datasheet showing how to model a MOSFET from a datasheet. If you google you can probably find other similar tutorials on creating models.