Shop OBEX P1 Docs P2 Docs Learn Events
I/O Pin Simulation Methodology? — Parallax Forums

I/O Pin Simulation Methodology?

John UptonJohn Upton Posts: 7
edited 2008-02-06 18:49 in General Discussion
Hello All,

A quick search of the archives, "Best Of" threads, and FAQ didn't turn up anything.

I am working on a medium complexity project using an SX-28 in an embedded controller application. The application uses one servo feedback PWM controlled DC motor, one open loop PWM controlled DC motor, a communications interface, two position feedback encoders, and a pushbutton interface.

In an environment with a rich set of asynchronous inputs occurring, what suggestions do you have for simulating interactions of this I/O in the code? Maybe this is a long-term feature request for SXSIM but I thought I'd ask how others handle the simulation of I/O when developing a project.

For now, all I can do is put in a bunch of breakpoints, run up to each and then use the SXSIM I/O panel to set the appropriate states and then run to the next breakpoint. For some inputs, this works OK but for others (like the servo feedback pulses), it's a real pain.

Ideally, SXSIM may someday allow (non-standard) source code statements to tell it assumed (simulated) input pin states for debug simulation. But for now, does anyone have any pet techniques they'd like to share on simulating I/O pin input during code development?


John

Comments

  • BeanBean Posts: 8,129
    edited 2008-02-06 15:27
    I would suggest using conditional compile directives.

    By making the input pins outputs during simulation, you will be able to set their state. Of course they will read as the same state you set them to inside the conditionals.

    Are you using ASM or SX/B ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
  • John UptonJohn Upton Posts: 7
    edited 2008-02-06 18:49
    Bean,

    Thanks a lot for the tip. I'd have never thought of that.

    It will take quite a bit of rework of the code (ASM) but should help a lot in even simple simulation.

    Still, I would think the ideal long term solution would be to be able to instruct a simulator (like SXSIM) to simulate I/O Pin input states either by embedding commands in the source code or supplying a separate "simulation stimulus file". I might envision something that could assert or de-assert pin input states based on register contents (like watches), cycle counts, time in simulation, etc.

    Anyway, thanks again for providing a possible solution. I will try a few simple cases to see how it goes in practice.


    John
Sign In or Register to comment.