Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

simulate inputs

Status
Not open for further replies.
I'm using MBLab 7.01, so that's what these instructions are targeted for.

To bring up the simulator run controls, go to Debugger menu -> Select Tool -> MBLAB SIM.

To view specific aspects of the simulated PIC, go to the View menu, and from there you can select program memory, file registers, special function registers (which is where you would get your simulated output pins), and such.

For input, go to Debugger -> Stimulus Controller -> New Scenario. Click in the first column under the Pin heading. Select which pin you desire from the dropdown menu. For the Action column, there are a few options. Set High, Set Low, Toggle, Pulse High, Pulse Low. Toggle is probably what you want, so that you can use a single Fire button ' > ' there in the first column of the stim controller box to turn a pin on and off.
 
you mean mplab version 7.00 has no way of simulating inputs?and i must download 7.01 to be able to simulate inputs? :shock:
 
oh, ok, i got it, i've been making many codes and programming it to the pic without testing the inputs in the simulator, i have been testing it on the real hardware :D how do you use the scenario thing, the attach and all?
 
Previous versions had the simulator too. It's just that I don't have the previous versions anymore, so if a menu is different, or the simulator is accessed a different way in any of the older versions, my instructions may need to be altered, which was why I mentioned my version number, just so you would be aware in case you ran into a problem and wondered why you were not seeing what I am seeing.

As for using the scenario thing... Um... reread my original post? Go into the scenario editor and assign a toggle trigger to your various pins. Want to be able to turn on Port A pin 3? Make RA3 to be a toggle, then run the simulator with that box still visible. Be sure to have the file registers and special function registers on-screen also. Start the program simulation. After the initialization, whenver you want you can click on the fire button > and you will notice that A3 is now a 1 in the special function registers window, and your program will operate accordingly. Click the fire button again, and A3 becomes 0.
 
That pretty much cover's it bonxer even for old versions.

I use version 5.62 (It's old but it is all that I need) and the procedure is virtually the same as for version 7 described by bonxer.

Select:

Project->Edit Project->Development Mode->"Choose Simulator as opposed to Editor"

You may have to rebuild the project at this point, because the mode selection clears some project files.

Then:

Debug->Simulator Stimulus->Asynchronous Stimulus and assign pin and type of action (by right clicking Stim buttons).

Or if you make a stimulus file (*.sti on version 5.XX) then at specific clock cycles the file will automatically change inputs.

That's about it.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top