Connect with us

simulation of microcontrollers

Discussion in 'Electronic Design' started by Abstract Dissonance, Dec 22, 2005.

Scroll to continue with content
  1. I was wondering how I can simulate microcontrollers. I am trying to make a
    simple "switching" circuit that basically lets users push buttons to call up
    presets that will switch between different "devices" and I figured that I
    would use a pic to do it. Unfortunately I have virtually no experience with
    any electronic stuff and I've just been playing around with EW Design Suite
    with flip flops and stuff to get an idea about what I need to do. From a
    little research I figure that I can do all the controlling with a pic with
    enough I/O lines and just do the switching and selecting in the software...
    the problem is I can't figure out how to put code in Design Stuite when I
    put down a MCU. I'm not sure if DS supports this or not but I have found
    several other pieces of software that either just simulate the chip itself
    and has a IDE for the code(but doesn't seem to simulate the electrical
    circuit aspect) or they just do the electrical circuits but not the code. I
    looked on EW's site and they had something called MultiMCU that interfaces
    with DS and does seem to do what I want but I'm not completely sure... and
    I'm definately looking for something that is free so I can play around with
    it and use it to learn.

    Any ideas? Or am I just going to have to purchase some hardware and a
    programmer and do it that way? I'd rather use software simulation as I'm
    much more comfortable because I can't really screw anything up.

    Anyways, I'll give my idea since its pretty simple and might shed some light
    on what I actually need(I know I probably don't need to simulate anything to
    do it since its pretty simple but I'd like to be able to play around without
    any fear of screwing up the chip by accident).


    I'll have N buttons that will select "presets". I'll need the ability to
    store the presents in memory.

    B1 -- |-----| --- DEVICE line 1
    .... | MCU | ...
    BN -- |-----| --- DEVICE line M


    So basicaly I have a Device which has M lines and I want to just select
    combinations of those lines (so I have M! possible combinations to choose
    from but only N buttons(4 probably) will be selectable(or maybe I'll use
    some bank method to get a few more)).


    So, say for example, B3 might have been configured by the user to select
    some preset that turns "on" lines 3, 6, and 8 and B4 might turn on lines 1,
    2, and 3. I figure its pretty easy to do in the software but since its
    actually a little more complex than that I'd like to simulate the other
    parts of the circuit along with the MCU. In actuality I need to debounce the
    switches(They are just momentary switches) and the Device lines are actually
    analog lines so the MCU will control switches that switch on certain analog
    line combinations.


    Also, I was wondering how much does it cost to fabricate this stuff
    "professionally"? Right now basicaly what I have done is to use dip
    switches to select different combinations of the DEVICE lines above... my
    goal is to make it much easier by just using a few switches(maybe I can just
    get away with one or two too and just use a button to cycle through the
    presets instead... maybe not)). For my application I am limited in size(the
    smaller the better) and the analog signals that it will control cannot be in
    any significant way be degraded. I'd like to put this in a small package
    and potentially sale it if I can find someone to buy it(not sure if theres a
    market for it but I'm sure a few people will buy it if its done right)...
    although its mainly just a stepping stone into learning more about
    electronics as I've always been wanting to get into it(and I've taken a few
    courses in EE).

    Thanks for any help,
    AD
     
  2. I'm wondering how one uses the MCU in EW Design Studio? You can place the
    components on the board but surely you have to code them to be useful in the
    simulation? I can't find any way to put code into them to do anything ;/
    Even if I can only load up a binary file into its memory space it would be
    better than nothing(cause I think I could probably find an assembler
    somewhere for the chip and assemble some code for it... but thats useless if
    I can't actually load any code onto the MCU in EW Design Studio ;/).

    Another thing, about the "Cost" thing I mention before... I was just looking
    for some reference so I have some idea how much it costs to "mass" produce
    PCB's(for something small ofcourse)... 10k$ for 100 units or what? I figure
    they have machines to do most of the work so it should be fairly cheap...
    depending on how hard it is to configure the machines though.

    Thanks,
    AD
     
  3. Pooh Bear

    Pooh Bear Guest

    Why bother simulating ?

    Just *do* it !

    Graham
     
  4. Paul Burke

    Paul Burke Guest

    Do it directly on the real hardware. Add probes (just a couple of spare
    outputs, that you can wiggle the point you are examining) to the code
    where necessary to allow you to see what's going on. For a program as
    simple as this (and a good deal more complex), it's often as good and as
    quick as having expensive development tools.

    Paul Burke
     
  5. MPLAB has "simulate" mode if you *really* want to simulate your PIC,
    but its usually easier to just build the thing and test it.

    You can "professionally" fabricate small projects like this yourself.
    PCBs can be ordered, and solder them yourself. Packaging is the only
    hard part, but there are plenty of nice cases out there, PCB mount push
    buttons etc. Cases can be punched and screen printed if needed.

    Dave :)
     
  6. Guest

    You want it free? Then what you're looking for is MicroDev:

    http://perso.wanadoo.fr/udev/

    Want a more expensive version? Then check out Proteus VSM:

    http://www.labcenter.co.uk/index.html?/products/vsm_overview.htm
     
  7. I think MPSIM is pretty useful, especially for testing software
    chunks. You can set unlimited breakpoints, see any register or memory
    location and 'time' things *exactly*. It would be difficult to create
    a 100% error free program of any substantial complexity without
    liberally using simulation or ICD/ICE to wring out every instruction
    of the code, including rarely taken branches and oddball conditions.
    Particularly early on when you're not that familiar with things.

    It would be nice if they had automatic code coverage analysis like
    Keil, but for free it's pretty good.

    For complex internals, I think it's better to spend time at higher
    levels of abstraction (designing on quadrille paper, testing an
    algorithm in C or whatever on a PC platform) before you even get to
    the that point.

    Best regards,
    Spehro Pefhany
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-