Simulating microcontroller pin?

Hey all, hope I'm not asking an FAQ-worthy question (at least, I haven't seen this question asked in searching).

I want to model an IO pin on a PIC16 MCU. This pin toggles up and down at ~100KHz between 0-5V, 50% duty cycle. I've found an AC voltage source set to square wave, 100khz, 2.5V amplitude and 2.5V dc offset works great.

However - it doesn't take into account this chip's current limitations. I'd like the current to be limited to 20mA like the real chip specs, but I'm really not sure how to go about this. I see I can define my own parameters using expressions but I don't understand the documentation enough to get results. Ideally I could set the sim so that the voltage source provides reliable 5V square wave up to 20mA, where the voltage then rapidly begins to tail off if the current should increase.

Has anyone had to do this/something similar before? Any advice much appreciated.

by r00x
December 18, 2012

Post a Reply

Please sign in or create an account to comment.

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.