On Wed, Nov 04, 2020 at 01:04:56PM +0100, Philipp Klaus Krause wrote: > Is it possible to simulate a small mixed analog / digital system that > contains a microcontroller? > > If yes, how could one e.g. integrate uCsim with gnucap? Are there > existing examples (possibly with other µC simulators)?
Hi Philipp. I had a cursory look at uCsim. It looks like a (rather complex) program that simulates instructions in a processor (on RT level?). Is your idea to connect the i/o ports of that processor to a circuit model? I believe that there are multiple ways. The "clean" one would be to implement a component plugin that run uCsim as a subprocess. This needs to pass over the control to the circuit simulator. A hackier way would be to connect the two simulators, pass data and synchronise. Sending and receiving timestamped signals during a transient simulation is relatively easy with Gnucap. There is an example here [1]. It may need a rewrite making proper use of discrete events. First I would try to do a similar thing on the uCsim end. cheers felix [1] http://git.savannah.gnu.org/cgit/gnucap/gnucap-plugins.git/log/?h=coupling
