How to work with the proteus 7.10 program. Proteus VSM. A Guide to Interactive Modeling. Where can I get the Proteus installation package?

  • 2.7. Upper (pluggable) toolbars.
  • 2.8. A set of left toolbar buttons. Connecting them with the object selector and the preview window.
  • 2.9. "How do I get to the library? At three o'clock in the morning? - (film “Operation Y”).
  • 2.10. We select components and arrange them into the project.
  • 2.11. Quick editing techniques. Routing of wires and buses.
  • 2.12. Quick editing techniques. Marking of wires and tires. Renumbering elements and assigning properties to them using Property Assigment Tools.
  • 2.13. Properties of microcontroller models. Setting numerical values ​​and dimensions.
  • Firmware" of the microcontroller in ISIS.
  • 2.15. First failed simulation run. Dancing with a tambourine or analyzing possible reasons for the failure of a real working circuit in a simulator.
  • 2.17. Useful properties of probes.
  • 2.18. Digital Graph – put into practice.
  • 2.19. Properties of a digital graph.
  • 2.20. Additional options for chart analysis when maximizing a window.
  • 2.21. Comparison with a running dynamic display project. We find the cause of the glitch.
  • 2.22. Menu and chart options in the Maximized window.
  • 2.23. We connect the firmware file for step-by-step debugging.
  • 2.24. Step-by-step program debugging mode in ISIS.
  • 2.25. Context menu of the step-by-step debugging window.
  • 2.26. Debug menu in expanded form.
  • 2.28. Debug menu in expanded form (end). Popup windows. Super useful Watch Window.
  • 2.29. Let's examine the source code in assembler. How and how to open and edit it.
  • 2.30. Real indication readings in the Watch Window.
  • 2.31. We correct the assembler file. “And yet she spins.”
  • 2.32. The final version of the project with working indication.
  • 2.33. Conclusions on the use of dynamic display in Proteus and in reality. Additional resources.
  • 2.34. Conclusion to the first part.
  • 2. Installation and launch Proteus. Program interface ISIS.

    2.1. Where can I get the Proteus installation package?

    The latest demo version is currently available on the official website of Labcenter Electronics, v.7.5.SP3. It has significant limitations: there is no option to save the project; mainly examples from the included Samples folder are simulated in real time. Considering the geographical remoteness of Foggy Albion and the decent size of the installer - more than 60 MB, I would not recommend downloading this package for evaluation purposes to those who have a slow Internet connection. But the world is not without “good” people. There is no point in giving specific links to file-sharing sites here; the life of files there is limited in time. Therefore, use a search on Google or another search engine with the parameters Proteus v.7 (or 6), Proteus VSM or Proteus ISIS and you will easily find the latest links. Just don’t use the search for one word “Proteus” or “Proteus” if you are not trying to purchase a strength training machine of the same name to pump up muscles.

    2.2. Installing the program on your computer.

    To install, you must run the Setup.exe installation package. During installation, Proteus (if this is not a demo version) will ask for the path to the license file. If at this moment there is no license file, you can simply select the option of having a license on the server and leave the server window empty, but before the first launch you will still need to install the license file licence.lxk using the license manager. By default, the program is installed in the directory: Program Files\ Labcenter Electronics\ Proteus 7, however you can change the path if you wish. As already noted for the professional version, after installation you must install a license. To do this, launch the license manager program (Fig. 1):

    START=>All Programs=>Proteus x Professional=>Licence Manager

    in the left window, through the Browse For Key File (manual) or Find All Key File (autosearch) buttons, select the path to the license file, then press the Install button, which becomes available when you click on the desired license in the left window, and the selected information should appear in the right window. After which the manager can be closed. Please note that opposite the key image the program functions available for this license are listed.

    Fig.1

    2.3. First launch and first problems.

    I. When you try to start ISIS or ARES, a message box appears:

    Cannot find a valid license key for ISIS (ARES) on this computer.

    Comment: there is no license, i.e. the previous paragraph has not been completed or has not been fully completed.

    II. When starting the simulation(including the attached examples from the Samples folder) it does not

    functions, and the following message appears in the Simulation log (Fig. 2):

    Cannot open "C:\DOCUME~1\=TECUSE=\Local Setting\Temp\LISAxxx.SDF’ Simulation FAILED due to fatal simulator errors

    where instead of \=TEKPOLS=\ there are incomprehensible squiggles (quacks)

    Comment: This problem is not relevant for versions starting from 7.4 and higher. Before this, Proteus categorically rejected the Cyrillic alphabet in the computer user name, as well as in the path to the project file and in the file name itself.

    There are two ways to solve this problem:

    1) Change username to English.

    2) Login to My Computer=> Properties => Advanced => Environment Variables. In the top window, select the TEMP variable, click Edit and replace %USERPROFILE%

    type %ALLUSERPROFILE% (it is necessary that in the Document and

    Setting\All Users there were corresponding folders Local Settings and Temp; they can simply be copied from the current user (folders HIDDEN) or created manually). You can, on the advice of Nemo78, change the path to %SYSTEMROOT%\Temp (this is exactly what it is without Local Settings), then Proteus will use the TEMP folder in the Windows system directory.

    III. The simulation starts, but after a few seconds (minutes) the program closes. The simulation only works with certain types of models. Examples from Samples

    simulated without problems.

    Comment: There is no license for one of the models used. You are using an “unofficial” (cracked) version and the crack is either not installed or installed incorrectly. Proteus has multi-level protection against illegal use, which is repeatedly checked during the simulation process. Files are protected as in the main program folder \BIN (Isis.exe, Ares.exe, License.dll, Prospice.dll), and in the model libraries folder \Models (Avr.dll, Lcdalfa.dll, Lcdpixel.dll, LedMPX.dll, Pic16.dll, Pic18.dll, Mcs8051.dll and some other models). Therefore, the simulation will only work with those libraries for which there is a license, or to which “rework” has been applied.

    2.4. ISIS program interface.

    Below is the main window of the ISIS program with explanations of the purpose of the main interface elements. In the future, I will adhere to exactly this terminology in a somewhat abbreviated form, i.e.: left menu, top command menu, top main menu, simulation buttons, object selector. The program window does not correspond slightly to the fully maximized window, because when the size was reduced, some menus changed position. Just like in many other Windows programs, the menu can be dragged to a location convenient for you inside the program window. Hooking the left mouse button onto the starting menu element (a rectangular gray stripe on the left for horizontal menus, and on top for vertical menus) without releasing the button, drag, for example, the orientation menu (in the picture the starting element is visible above the right rotation arrow) inside the window to the right vertical border window and after releasing the button it will “stick” vertically to the right. You can do the same with any of the top command menus. This way you can customize the arrangement of program elements that is convenient for you. Another nice feature of the program: if you right-click inside the selector window and left-click on the Auto Hide function in the pop-up window, the selector will automatically collapse if the mouse cursor is not hovering over it. This allows you to gain some space for the editing window on 4:3 monitors. Cancel this mode by repeated actions.

    Fig.2

    2.5. The Samples folder is a treasure trove of example projects for beginners.

    When you launch ISIS for the first time, two pop-up windows appear. In one of them you will be asked to check for updates - here you can safely check the “do not show again” checkbox. Another window offers to open the numerous Sample Designs included with the program. If you are truly a novice user, do not rush to check the same box for blocking repeat display. Well, if you’ve already blocked this window, don’t despair. Quick access to examples is always possible through the top menu Help => Sample Designs. Why do I so strongly recommend reading the examples? Yes because the third

    Some of the questions coming to the forum have ready-made answers included with the program

    examples. Unfortunately, in order to get acquainted with the contents of a particular example, you have to open it, since in most cases it is impossible to understand from the file name what is inside. With the sixth versions of Proteus, Help with examples was included, but in the seventh versions, for some reason the developer quietly snatched it away. It is not possible to describe the contents of all examples here due to the large amount of information. So I'll just stop

    on the most significant ones for beginners and I will attach the original file SAMPLES.HLP from version 6.9sp5. Of course, it does not contain a description of examples for new MKs added in subsequent versions, as well as examples of software generators from versions 7.4 and 7.5, but for those who speak even basic English this Help is of great help. Moreover, even with installed

    With the latest versions, when you click on the green name of the project in the help, it opens automatically.

    Schematic & PCB Layout is one of the most interesting folders for beginners. All projects, with the exception of Shiftpcb, contained in it are not intended for real-time simulation, but at the same time they have both a completed version of the xxx.DSN circuit in ISIS, and a design of the xxx.LYT board in

    Pay attention to Cpu projects using MK Z80 and Dbell - doorbell. These projects have intermediate PSB (board) files named Cpuu.LYT and Dbellu.LYT with components not installed on the board. By opening these projects in ARES, you can try out the automatic component placement feature yourself. Just select Tools => Auto Placer in the top menu and simply click OK in the window that opens. In the Cpu.LYT and Dbell.LYT projects, the components are already placed, but you can similarly try auto-routing tracks Tools => Auto Router . The Cpur.LYT and Dbellr.LYT projects contain already routed boards. At any stage in ARES, through the top menu Output => 3D Visualization you can call up 3D

    image of the board and, using the left mouse button, rotate it and examine it from all sides

    (Fig.3).

    Fig.3

    I’ll specifically focus on the Shiftpcb.DSN project – a 16-bit shift register based on small logic. It deserves attention for two reasons. Firstly, it uses a 4-stage hierarchical structure, i.e. it is a complex project. The first sheet contains four modules of four-bit shift registers. To view the structure of each module, you need to right-click on it (the element will turn red) and select the Goto Child Sheet (Ctrl+C) option from the pop-up menu - go to the child sheet. Similarly, you can get to the next level and further to the final one, containing a regular RS-trigger on 2 AND-NOT elements.

    You can also return to the previous level by right-clicking, clicking only on the free space in the window and selecting the Exit to Parent Sheet option. Secondly here

    You can run the simulation after some design adjustments and see with your own eyes how the shift register works. In its original form, the project is adapted to the graph placed on the first sheet, so when simulating through the Play simulation control button, we will receive a warning in the log (yellow exclamation mark) about the computer’s CPU load being 100% and the impossibility of real-time simulation:

    Simulation is not running in real time due to excessive CPU load

    The window will open if you click on Simulation Log with the left mouse button. Immediately get used to the traffic light principle in Simulation Log: red sign - gross error - simulation is impossible; yellow (“mustard plaster”) – warning – the simulation may be running, but the result is incorrect and green – the simulation is running normally without errors. Therefore, to avoid the warning it is necessary in the properties of the generators D and Clk (accessible via the right mouse button

    option Edit Properties Ctrl+E) set Pulse width 200m and 100m (in this case milliseconds) respectively. By starting the simulation with the Play button, you can then observe the state of the shift register outputs on the contacts of connector J2.

    The same folder contains other examples:

    EPE.DSN – a large EPROM programmer project on three sheets (transition between sheets

    accessible through the top Design menu or by right-clicking on an empty space in the editing window and selecting the appropriate sheet 1, 2 or 3). Some sheets contain submodules. You have already learned that they have a dark blue outline and correspondingly available child sheets.

    FEATURES.DSN - The project shows different ways of executing circuits in ISIS. Pay attention to the upper right corner: a version of a stereo preamplifier, designed in the form of 2 submodules with daughter sheets.

    PPSU.DSN is a very simple voltage stabilizer project. Has two PSB options: PPSU.LYT

    – for microcircuits in a DIL8 package (through-hole mounting) and PSMT.LYT - m/cx in a planar SO8 package. Please note that for some reason in Russia DIL – Dual-In-Line is usually called DIP. If you choose a DIP Dual-In-Plane case for the PSB in Proteus, you will not see any holes in the board! The Coffin will be output to ARES as planar with a pitch of 2.54mm.

    SIGGEN.DSN – signal generator project. The help famously states that it is simulated - yes, but after significant editing.

    STYLE1, 2, 3 – examples of different designs for the same project.

    THERMO – thermometer with a thermocouple as a sensor and indication on seven-segment indicators. Not simulated here, but in the VSM for PIC18\ MAX6675 Thermometer folder there is a working project with a program for PICC18 and a project for MPLAB.

    dsPIC33_REC – the pressure recording device project, similar to the previous one, has a working

    double in the VSM for dsPIC33 folder.

    Interactive Simulation – folder contains subfolder Animated Circuits with very simple animated examples for beginners.

    Basic - examples starting with this abbreviation are based on basic knowledge of electrical engineering: light bulb, battery, switch, potentiometer and show the flow of current in the circuit.

    MVCR – a series of examples using voltmeter/ammeter virtual instruments. PCV - examples with current limiting potentiometer.

    Intres - examples of the internal resistance of a current source. Cap - three examples of how a capacitor works.

    AC – examples with alternating current.

    Diode – examples of the use of diodes and diode bridges. Inrel - examples of the use of inductors and relays. TRAN – seven examples with transistors.

    Opamp - six different examples with op-amps. They deserve special attention. There is an option to enable the op-amp as a comparator (Opamp1.DSN). All this is animated, hung with virtual instruments, you can spin it and look at the reaction of the op-amp.

    Osc are examples of generators. Osc03.DSN and Osc04.DSN on a 555 timer containing a child sheet with an internal timer structure on Spice primitives. This is a “launching pad” for mastering the creation of your own models.

    Comb and Seq are examples for mastering the operation of logical digital circuits.

    Well, a few informative examples: TRAFFIC.DSN - a traffic light, COUNTER.DSN - a four-digit counter on the 74LS390, TTLCLOCK.DSN - a clock on TTL logic, LISSAJOUS.DSN - the use of a virtual oscilloscope for observing Lissajous figures and LM3914.DSN - the use of the driver of the same name for control of a linear LED scale.

    The remaining subfolders from Interactive Simulation contain examples of projects using the virtual instruments of the same name from the Proteus libraries: Counter Timer - use of a virtual timer/counter in timer and frequency counter modes. Motor Examples – examples of projects with stepper motors. Pattern Generator – examples of using a virtual code sequence generator. COMPIM Demo is an example of using a virtual COM port and a virtual terminal in Proteus. The latter, to perform the simulation, requires the presence on the computer of two real COM ports connected by a null modem cable, or the installation of a virtual COM port program on the computer to simulate a connection with a real one. In this case, in simulation mode, you can organize data exchange through this connection from the ISIS program with any program on the computer that allows you to work with a COM port (for example, the standard Hyper Terminal).

    The remaining subfolders from the Samples folder contain example projects using the corresponding series of microcontrollers (for example, VSM for PIC16 - examples with Microchip PIC16 microcontrollers). I will not consider them in detail now, since the most interesting ones will be considered later, as the ISIS program is mastered.

    Here I will just list that Graph Based Simulation contains examples of using various types of graphs to study circuits; we will turn to the Tutorials folder when creating our own models. I will especially note two folders: VSM MPLAB Viewer and VSM AVR Studio Viewer. These folders contain examples of how to share related tools. Wherein

    In general, there are a lot of systems for modeling electronic circuits. Of all the ones I saw I liked the most Multisim And ISIS Proteus. Multisim has a very convenient interface, and it is convenient to debug analog devices, because it allows you to use virtual (that is, you specify the parameters yourself) transistors and amplifiers, but does not support complex systems at all, such as microcontrollers or various types of drivers. More precisely, it supports, but extremely sluggishly. Only recently has it added support for the ancients AT89C2051 and several PIC's

    Against, Proteus It can work wonderfully with controllers, but is limited by its library of real elements, so without knowing exactly what part you need, you can’t do much there, and it also has a simply miserable interface, but this is the best modeling system I’ve ever seen. And therefore I will describe it exactly.

    Weighs about thirty meters in the archive, the latest version that I know of is 7.2 Just keep in mind that the cracked version of Proteus sometimes works very strangely, for example, you see the processor code, but debugging does not work and the registers have left values. So search carefully ;))))

    I propose to immediately take the bull by the horns and quickly simulate some simple circuit on a microcontroller. I will explain where everything is as the process progresses.

    Launch Proteus, a beige window with dots should immediately open. This is the working field. This is where we will build our scheme. For example, let's build a circuit on my favorite controller AT89S51 it will not do anything useful, it will simply send letters to the terminal window by pressing the buttons attached to the controller ports.

    To add a component you must first select black arrow in the upper left corner, and then press the button with magnifying glass and triangle it is located on the top toolbar in the middle.

    A huge list of elements that it knows will open. Proteus. Libraries are constantly being supplemented and updated, so scour the internet for new details.
    Find the controller in the list AT89S51, so as not to mess around, use the keyword search - just type “ AT89"you'll see the whole family MSC-51 famous Proteus.

    Choose the one you need and click " OK" Then place the chip in a place convenient for you. Let me make a reservation right away that the models of the processors in Proteus somewhat simplified, so they do not require the presence of quartz in the virtual circuit, a reset system (lift RESET to the required level), the presence of a signal to use the internal memory (+5 on EA, a feature of the processors C51 who can work from outside ROM) and we shouldn’t forget about this when we eventually make a real circuit, otherwise, in the end, it can take a very long time to look for the reason for a non-working circuit.

    Although they are not needed, we will still add body parts. Again, point at the magnifying glass with the triangle and look for quartz there, the bourgeoisie call it “ crystal“Here it is and put it on the diagram next to the conclusions XTAL.

    The main wretchedness of the interface Proteus The problem is that the right click always first selects and then deletes the component, and the left click places a new one of the same type. It's terribly annoying, Multisim everything has been done much more conveniently and traditionally, but, alas, Multisim not so powerful.

    Now move the cursor to the quartz pin and connect it to the pin XTAL1 processor, do the same with the second quartz leg, only on XTAL2. Now we need conders, go to the library again and look there Capacitors. There will be a huge list of real Conders, choose one SMT capacitor with a capacity of about 33pF. In the upper window on the right there will be its designation in the diagram, and below are the overall dimensions, or rather the contact pads for its sealing.

    By the way, look at the window just below the search bar. Do you see the line there Modeling Primitive? There are virtual primitives there. They don’t have a housing, so when laying out the printed circuit board they will pop up with an error, but if you are not going to lay out the board, but just want to model the circuit, then it’s better to take it - its values ​​can be changed as you like.

    Stick a couple of conductors next to the quartz and hang them on the legs of the quartz with one terminal, and combine the second and hang them on the ground. Where to get land? Good question:). Look in the left toolbar for these two things that look like tags, called Terminal mode. Poke it, a panel will open right next to it, on the left, where you need to select a line GROUND this is the earth. Install it wherever is convenient for you. Power in the same place - this is the supply voltage of the circuit. Usually it is common, but sometimes there can be problems with the fact that the circuit has multiple power supply (as, for example, in a computer, there are 5 and 12 and 3.3 volts and in general there are a lot of different voltages).

    Next you need to assemble a reset circuit. Proteus does not need this, it will work normally anyway, but a real circuit needs it. This is done simply. We install a resistor and capacitor. When turned on, when the capacitor is not charged, its resistance is zero and the output RST+5 volts are supplied, i.e. logical 1, and as soon as the condenser is charged, this will happen in a couple of milliseconds, then the leg through the resistor will lie on the ground, and this is a real logical zero and the percent will start in normal mode.

    Do everything as in the picture and start attaching buttons to our device. It is better to hang on port 1. Why? And additional resistors are not needed. The fact is that on the C51 port 0 is made with the ability to work on the data bus, which means it has the so-called Z state. This is when the output is neither 1 nor 0, there is a high resistance (impedance), almost a break, but the port can sniff the bus without warning at this time for the values ​​flying there, without giving itself away or interfering with other devices.

    Port 3 is hung with all sorts of additional peripherals, and port 2 is not very conveniently located in the proteus model. Therefore, we use port 1 :))))). Look for some switch or button in the library. I like the button component, that's why I use it. I’ll put four buttons and hang them on pins P1.0, P1.2, P1.4, P1.6, and put the other pins of the button en masse on the ground. How will it work?

    It's simple! First, I output one to the port for all outputs. The legs from the inside are immediately pulled up to the logical unit. Now, in order to read the data, it is enough to take the value from the register of port P1, and if we press any of the buttons, then this leg is firmly planted on the ground, overpowering the internal pull-up to one. Those. the pressed button gives a zero on its bit in the port. This is the principle of detecting a button press in all microcontrollers. I also strongly recommend that you bypass the buttons with 40pF capacitors - there will be no false alarms from impulse noise.

    But this is only in real devices, in Proteuse It still doesn't matter, but I'll add it. That's it, data entry is ready. Now we need to draw a conclusion. For output, you can stupidly hang virtual LEDs on the legs and also blink them virtually, but this is bad manners, although, I don’t argue, it often helps to debug the program.

    I prefer to pamper myself with my loved ones UART ohm In other words, a terminal. Let's go to the virtual instruments section. Look for an icon with a drawn arrow device on the left toolbar and go there. You will have a list of all the junk that you can use. Here you have a voltmeter, an ammeter, an oscilloscope, a digital analyzer and various highly specialized gadgets like a protocol monitor SPI or I2C. For fun, take an oscilloscope ( oscilloscope) and hang it with one channel to the output TxD. We also need Virtual Terminal. Select it and paste it into the diagram. Now connect its outputs with the outputs of the processor, crosswise. Rx with Tx, Tx with Rx.

    Ready! Well, for complete happiness, put another LED on the port P2. How to connect LEDs to the ports of the processor? Yes, very simple! You hang the plus of the LED on the power supply, and the minus on the resistor, and this resistor is already on the output of the processor. To light the diode, you need to output 0 to this leg.

    Then the voltage difference between the supply voltage and the zero voltage on the leg will be maximum and the diode will burn. Search in components LED Well, stick it in like I told you. I’ve probably already noticed that more often we define or set an event by zero, rather than by one. This is due to the fact that it is easier to force zero than to pull the legs up. But this is not always the case, for example, family controllers AVR They know how to set their legs tightly both to zero and to the supply voltage, so you can light the diode there with one. To do this, you will need to turn it over and hang it with the other end through a resistor Power, and to the ground.

    So, we drew the hardware part. It's time to start setting up and debugging.

    Select the microcontroller and double-click on it, the properties window will open.
    PCB Package- this is the type of housing, it is important when laying out the printed circuit board. Let it be DIL40

    Program File– this is the actual firmware file. Here you need to enter the path to the hex file.

    Clock Frequency– the frequency at which the processor will operate.

    In real life, the frequency depends on the quartz, or on the built-in clock generator. IN Proteus it is exhibited here. Don’t forget to set it correctly, since the default values ​​often differ from those that you are going to use.
    Set the required processor frequency and write down the path to the firmware, and this completes the configuration of the circuit. You can start debugging.

    Click the button with the icon Play like on a tape recorder. Everything is simple here, no complications. I will only note that the step-by-step mode is simply an intermittent launch with a slight time delay. To debug, you need to use code debugging.

    Now your scheme works. You can observe the processes taking place in it. If you select the voltmeter in the toolbar, you will see the voltage, or you can measure the current if you use the ammeter. The colored squares that light up on the processor legs are logical levels. Blue is zero, aka earth. Red is a logical one, and gray is a high impedance, aka Hi-Z.

    In principle, this is already enough to debug the operation of the device. What, we debug the program in Keil uVision(if we are talking about C51) or in AVR Studio, compile and see what happens. This works great on simple devices with one control controller and harness.

    But when you have several microcontrollers or a controller and some very smart device working in your system, for example a Dallas key, then serious hemorrhoids begin, since it is difficult to say at what point in time which of the controllers is doing what. In such a situation, the internal debugger will come to our aid. Proteus, which allows you to debug a program using source code without leaving the simulation.

    Adding the source.
    Go to the menu and look for the item there Source and boldly poke at him with an unwavering hand. Choose Add/Remove source and add the source. I advise you immediately, so that the compiler does not become stupid, the source codes should be followed along simple paths, without spaces and Russian letters. For example, like mine: “ d:\coding\C51\hack_2.asm“When adding the source, do not forget to indicate the compiler with which it will need to be compiled. For this case in “Code generation tools” must indicate “ ASEM51”, that is, the architecture compiler MCS-51.

    Click OK and in the menu Source Another item will appear - added source file, by selecting which the editor will automatically open and you can quickly correct the program text.

    Compiler settings.
    Go to the menu again Source and look for the item “ Define Code Generation Tools” are compiler options. Initially they are configured crookedly - in the “ Make rules"poke at the line" Command Line” and take out all the garbage that is there. Just leave it “%1 ” without quotes. ASEM51 smart infection, it will add the necessary files with descriptions of registers and variables, especially since the entire family MCS-51 all addresses are the same.

    Compilation
    Click on the same menu Source paragraph Build All and get it at the exit hex file, but locally made. The compiler window will blink there, which will contain information about errors and a number of service data.

    Launch
    Launch the circuit with a button Play in the bottom panel and immediately press either pause or step-by-step mode. A window with the program code should immediately open, just like in the debugger you are already familiar with. If it doesn't open, you can find it in the menu Debug -> 8051CPU -> Source Code - U1

    There will also be a lot of other useful things, such as the contents of processor registers or program/data memory.

    Red running dude– launching the code for execution.
    Leg jumping over a bullshit– execution with skipping procedures
    Leg with down arrow– follow one instruction, take a step.
    Leg with up arrow– exit the subroutine.
    Leg and forward arrow– execute to the cursor.
    Circles with arrows– setting/removing/disabling BreakPoint breakpoints. A breakpoint is a place in a program where your program will stop dead in its tracks and move on only with your consent - an irreplaceable thing in debugging.


    When you add a second processor to the project, its code, registers and memory will be there, but it will be called Source Code – U2 and so on.
    In addition, in the directory Proteus there is a folder SAMPLES here are a bunch of different examples, very complex, showing the capabilities of the system ISIS Proteus.

    ZY
    I wrote this article for Hacker magazine. In a slightly different form (a little more detailed) it was published in the magazine for December 2007.

    Proteus is a universal program with which you can create various virtual electronic devices and simulate them. It contains a huge library of analog and digital microcircuits, sensors, discrete elements: resistors, capacitors, diodes, transistors, etc. There is also a wide range of optoelectronics components: displays, LEDs, optocouplers, etc.

    The main advantage and difference between Proteus and other similar programs for simulating the operation of electrical circuits is the ability to simulate the operation of microprocessors and microcontrollers (MCUs). The Proteus library contains the following main types of microcontrollers: AVR, ARM, PIC, Cortex.

    As with any other similar software designed to simulate the operation of electrical circuits, this software has a number of virtual measuring instruments: ammeters, voltmeters, wattmeter, oscilloscope, logic analyzer, counter, etc.

    Proteus also has built-in tools for automated development of printed circuit boards and for creating their 3D models.

    To simulate our first program, we only need an ATmega8 microcontroller, a resistor and an LED from the library.

    Settings Proteus 8.4

    Any setup begins with startup. In the window that appears, click on the icon of a diode with a capacitor Schematic Capture(Circuit design).

    After this, a window with an empty field will open.

    Now let's add the ATmega8 microcontroller, resistor and LED.

    The default mode is set to the appropriate mode Component Mode therefore, to get to the menu for selecting electronic and other elements, just click on the P button located on the panel DEVICE(device). After this, a window will open in which you need to select from the menu Category(Categories) Microprocessor ICs(microprocessors), in Sub-Category(Subcategories) – AVR Family. Next in the window Results find and select MK ATMEGA8. Click on the button OK.

    After that it will appear in the window menu DEVICE and you can already drag it with the mouse into the work area.

    Similarly, add a resistor and LED.

    LEDs are in the category Optoelectronics(Optoelectronics) and further in the subcategory LEDs. In this example it is selected green. LED-GREEN.

    Now we assemble the circuit, as shown in the figure below. We connect resistor R1 to the pin of MK PC0, which is connected to the anode of LED D1. We connect the cathode of the LED to ground. The "ground" element is in the tab menu Terminals Mode.

    To change the resistance value of resistor R1, you need to double-click on it. In the window that opens, set 300 Ohms in the line Resistance(resistance).

    Please note that the microcontroller pins in Proteuse are grouped into separate groups by port for convenience. However, this does not correspond to their location in a real MK. In addition, there are no terminals to which voltage is supplied to power the MK. This feature is installed by default.

    Writing a program to the microcontroller memory

    Now all that remains is to write our code into the virtual MK. Double-click on it with the mouse and in the new one that appears, indicate the path to the file with the code. Find the location of the file by clicking on the open folder icon in the line Program File.

    In the project folder we find the folder Debug and in it select a file with the extension HEX. After this, press the button Open.

    Good day, dear colleagues! I have long wanted to tell you about my experience in modeling circuits on a computer. In addition to the well-known one, there are many other emulators, but not many people know how to use them, or indeed where to get the normal version of the program. I used to ask myself this question too. When I was still at school, in grades 10-11, I became interested in modeling circuits in the same programs. I met a guy who was also interested in electronics, and he told me about such a wonderful program as Proteus. I uploaded it to my email, although at that time I didn’t have a normal Internet connection and it wasn’t easy to download it.

    So, having downloaded Proteus from the mail, I started the installation - everything is very simple, but beginners may still have some problems, so I will describe the installation itself step by step:

    Installing the Proteus program

    1) Download the program itself, there are 2 options - either download it yourself from the Internet, or write to me by email.

    3) In the archive itself there is a list of useful programs that I currently use, here are AVR Studio, and Barracks and Sina Prog - they will all work, you’ll see.


    4) Find the file Proteus setup 7.7, click “install”, during the installation process it will ask for a key, click “download from server”, then (in English Next ), and after a while the program will complete the installation.


    5) Now, as ADMINISTRATOR, run the program Crack Proteus 7.7, if not from the administrator, then nothing will come of it.


    6) Those who don’t speak English well can Russify the program, but I had some gibberish, and I also know English quite well, so I left it as is.


    Working with Proteus

    Let's start with the simplest model - take the ATMEGA-8 microcontroller and in C++ we will write a program for it that will blink one LED, for this we will perform the following steps:

    1) In the archive with Proteus there is an AvrStudio4Setup file, run it, it does not require any key, but there is one condition for the normal operation of this program - more about it later...


    2) When installing the program, it will automatically prompt you to install additional drivers on the USB - you need to confirm this action, then you will understand why.

    3) Then install a program called Win AVR, its installation is intuitive, so I will not describe it in detail.


    5) I didn’t want to open the program on Eight, so I downloaded version 5. If anyone wants to do the same, I will write further about the 5th version, it is slightly different from the 4th.

    6) Launch the program, select a new project.


    7) At the bottom, enter the name of the project and the directory where it will be saved.



    9) Enter the text of the program, press F7-debugging, further F5-Creation.

    10) My text is like this:

    11) #define F_CPU 1000000UL // specify the frequency in hertz
    12)
    13) #include
    14) #include
    15)
    16) int main(void) ( // start of the main program
    17)
    18) DDRD = 0xff; // configure all port D pins as outputs
    19)
    20) PORTD |= _BV(PD1); // set "1" (high level) on pin PD1,
    21) //light the LED
    22)
    23) _delay_ms(500); // wait 0.5 sec.
    24)
    25) PORTD &= ~_BV(PD1); // set "0" (low level) on pin PD1,
    26) //turn off the LED
    27)
    28) _delay_ms(500); // wait 0.5 sec.
    29)
    30) PORTD |= _BV(PD1); // set "1" (high level) on pin PD1,
    31) //light the LED
    32)
    33) _delay_ms(500); // wait 0.5 sec.
    34)
    35) PORTD &= ~_BV(PD1); // set "0" (low level) on pin PD1,
    36) //turn off the LED
    37)
    38) ) // closing parenthesis of the main program

    41) Let's move on to proteus. Opening Isis.


    42) In the line on the side, select Component Mode.


    43) Microprocessors

    44) Select our controller.


    45) We are building a diagram.


    47) Now we indicate the folder where we saved the program code, it must have the extension hex.

    48) Program the controller, then press launch, we see the LED itself blinking.

    So we have learned the basic data on modeling. But this is not all the capabilities of the Proteus program. Now let's use the package Ares to create a 3D printed circuit board.


    For example, I chose a ready-made model.

    But the program also has the ability to create new projects. After building the board, select Output , 3D visualization , and voila: the 3D board is ready. I hope this article has helped me at least a little in mastering this useful amateur radio program. I was with you Columnist.

    Discuss the article PROTEUS

    The purpose of this tutorial is to show you, by creating a simple circuit, how to perform interactive simulations using Proteus VSM. For now we will concentrate on using Active Ingredients (Active Components) and the debugging capabilities of the ISIS editor, we will also cover the basics of tracing and the basics of circuit management. A complete overview of these topics can be found in the ISIS help system.

    The circuit we will use for the simulation is two traffic lights connected to a PIC16F84 microcontroller as shown below.

    While we are drawing the diagram from scratch, the finished version can be found along the way “Samples\Tutorials\Traffic.DSN” in the folder where you have Proteus installed. Users who are familiar with the basic methods of working in ISIS can select a ready-made circuit and proceed to the section on the microcontroller program. However, please note that this project file contains an intentional error - read for more details.

    If you are not familiar with ISIS, the interface and basic usage are covered in detail in ISIS Editor Overview, and while we'll cover these issues in the next section, you should take the time to familiarize yourself with the program before getting started.

    Drawing a diagram

    Placing elements

    Let's start by placing two traffic lights and a PIC16F84 on a new circuit layout. Start a new project, select an icon Component (Component) (all icons have tooltips and context-sensitive help to aid their use). Then left click on the letter 'P' at the top of the object switcher ( Object Selector) to open the Library Browser window ( Library Browser), which will appear on top of the editor window (for more details, see Circuit Input Basics in the ISIS help system).

    Press the P button on your keyboard and type ‘Traffic’ in the Keywords field ( Key words), and double-click the result to move the traffic lights to the object selector. Do the same for PIC16F84A.

    Once you have selected the traffic lights and PIC16F84 into your project, close the Library Browser and click once on PIC16F84 in the object selector (this will highlight your selection and the item will be shown in the preview window in the top right corner of the screen). Now left click on the editor window to place the element on the diagram - repeat the process to place two traffic lights on the diagram.

    Moving and Orienting

    We created the circuit nodes, but accidentally didn't place them perfectly. To move an element, right-click on it (this will select the element), then hold down the left mouse button and drag the element (you will see an outline of the element “following” the mouse cursor) to the desired position. When the outline is where you want it, release the left mouse button and the element will move to the specified position. Please note that the element is currently still selected - right-clicking on an empty area of ​​the editor window will return the element to its normal state.

    To rotate an element, right-click on it in the same way as in the previous case, and then left-click on one of the rotation icons ( Rotation). This will rotate the element 90 degrees - repeat this as many times as required. Again, a good way is to right-click on an empty area of ​​the diagram when you're finished to restore the element to its original state.

    Lay out the diagram in a meaningful way (for example, based on ease of comprehension), and move and rotate elements as needed. If you have problems, we recommend working through the tutorial in the ISIS help system - ISIS Tutorial.

    For our purpose, we'll ignore 2D graphics to avoid confusion and concentrate on creating the simulated circuit - for those interested, a full report on ISIS's graphics capabilities can be found in the 2D Graphics section.

    Scale and Capture

    As a rule, when laying out a diagram, it is useful to be able to change the scale of the required area. Pressing the F6 key or icon Increase (Zoom In) will zoom in around the current mouse position, or, alternatively, hold down the SHIFT key and, while holding down the left mouse button, select the area you want to zoom in on. To zoom out, press F7 or the icon Decrease (Zoom Out), or if you want to zoom out so you can see the entire diagram, press F8 or use the mouse wheel to zoom out or zoom in on the area you want. The corresponding commands can be accessed from the menu View (View).

    ISIS has very powerful capabilities called Real Time Snap. When the mouse cursor is near the end of a pin or wire, the cursor location is captured by these objects. This makes it easy to edit and manage the diagram. This feature can be found in the Tools menu ( Tools) and is enabled by default.

    More information about scale and capture can be found in the ISIS Help - Editor Window.

    Connection Tracing

    The simplest way to connect a circuit is to use the auto wire routing option ( Wire Auto Router) in the Tools menu ( Tools). Make sure it is enabled (a check mark should be visible in the menu to the left of the option). For more information, see the section “Auto-routing a conductor” in the ISIS Manual. Enlarge the PIC so that all pins are visible, then place the mouse cursor on the end of pin 6 (RB0/INT). You will see a small 'x' cursor at the end of the mouse. This shows that the mouse is in the correct position to attach a wire to that pin. Left click the mouse to start the connection, and then move the mouse to the pin connected to the red light of one of the traffic lights. When you get the 'x' cursor over this pin again, left-click to complete the connection. Repeat this process to connect both traffic lights as shown in the sample circuit.

    A couple of questions about the wiring process that deserve mention:

    • You can make connections in any mode - ISIS is smart enough to understand what you're doing.
    • When wire autorouting is enabled ( Wire Auto router), is deployed around obstacles and, as a rule, a convenient trajectory between connections is sought. With this method, typically you only need to left-click on both ends of the connection and let ISIS take care of the path between them.
    • ISIS will automatically move the screen if you touch the border of the editor window by moving the explorer. With this in mind, you can zoom in to a suitable level and, provided you know the approximate position of the target element, simply nudge the screen until you see it. Alternatively, you can zoom in and out while you move the explorer (using the F6 and F7 keys).

    Finally, we must connect pin 4 to the power terminal. Select an icon "Terminal" (Terminal) and highlight "Nutrition" (POWER) in the object selector. Now left click on the appropriate place and place the terminal. Select the appropriate orientation and connect the terminal to pin 4 using the same method as before.

    At this point, we recommend that you download the completed version of the diagram - this will eliminate any confusion if the version you drew differs in some places from ours! Also, if you have not purchased the pic controller model library, you must download the prepared example file in order to continue.

    Writing a program

    Source program listing

    For the success of our consultation, we have prepared the following program, which is written into the PIC to control traffic lights. This program is prepared in the file TL.ASM and can be found in the folder “Samples\Tutorials”.

    ; PIC16F844 is the target processor LIST p=16F84 ; Include header file #include "P16F84.INC" ; Temporary storage CBLOCK 0x10 state l1,l2 ENDC org 0 ; Start up vector. gotosetports; Go to start up code. org 4; Interrupt vector. halt goto halt ; Sit in endless loop and do nothing. setports clrw ; Zero in to W. movwf PORTA ; Ensure PORTA is zero before we enable it. movwf PORTB ; Ensure PORTB is zero before we enable it. bsf STATUS,RP0 ; Select Bank 1clrw; Mask for all bits as outputs. movwf TRISB ; Set TRISB register. bcf STATUS,RP0 ; Reselect Bank 0. initialise clrw ; Initial state. movwf state ; Set it. loop call getmask ; Convert state to bitmask. movwf PORTB ; Write it to port. incf state,W ; Increment state in to W. andlw 0x04 ; Wrap it around. movwf state ; Put it back in to memory. call wait ; Wait:-) goto loop ; And loop:-) ; Function to return bitmask for output port ;for current state. ; The top nibble contains the bits for one set ;of lights and the lower nibble the bits for ;the other set. Bit 1 is red, 2 is amber and ;bit three is green. Bit four is not used. getmask movf state,W ; Get state in to W. addwf PCL,F ; Add offset in W to PCL to calc.goto. retlw 0x41 ; state==0 is Green and Red. retlw 0x23 ; state==1 is Amber and Red/Amber retlw 0x14 ; state==3 is Red and Green retlw 0x32 ; state==4 is Red/Amber and Amber. ; Function using two loops to achieve a delay. wait movlw 5 movwf l1 w1 call wait2 decfsz l1 goto w1 return wait2 clrf l2 w2 decfsz l2 goto w2 return END

    There is actually an intentional bug in the code, but more on that later...

    Attaching the source file

    The next step is to attach the program to our circuit so that we can successfully simulate its behavior. Let's do this through menu commands Source (Source). Now go to the Source menu and select the command “Add/remove source files” (Add/Remove Source Files). Click the New button, go to the “Samples\Tutorials” folder and select the TL.ASM file. Click “open” and the file will appear in the drop-down list of source code file names ( Source Code Filename).

    Now you need to select a code generation program for the file. The MPASM program is suitable for our purpose. This option will be available from the dropdown list Code Generation Tool, select it in the usual way by left-clicking (note that if you plan to use a new assembler or compiler, you need to register it using the command “Define a code generation program” (Define Code Generation Tools)).

    Finally, you need to determine which file the processor is working with. In our example, this will be tl.hex (a hex file generated by MPASM, which is the result of a tl.asm translation). To attach this file to the processor, click on the pic controller first with the right mouse button, and then with the left one. This will open the item edit dialog form, which contains a field “Program file” (Program File). If it does not already have tl.hex installed, then enter the path to the file either manually or by browsing to the location where the file is located by clicking ‘?’ to the right of the field. After installing the hex file, click OK to exit the dialog form.

    Now we have attached the source file to the project and set which code generation program will be used. More detailed explanation source code control systems available later in this documentation.

    Debugging the program

    Circuit Simulation

    To simulate the operation of circuits, left-click on the button Play on the animation model in the lower right corner of the screen. The status bar will show the time the animation has been running. Notice that one of the traffic lights is green while the other is red, and you can also see the logic levels on the pins in the diagram. However, note that traffic lights do not change state. This is due to an intentional error being introduced into the code. At this stage it is suitable to debug our program and find the problem.

    Debug mode

    To ensure that we are thorough in debugging, we will stop the current simulation. Once you're done with this, you can start debugging by pressing CTRL+F12. Two windows will appear - the first stores the current register values, the second shows the source code of the program. Any of them can be activated from the menu “Debugging” (Debug) together with a set of other information windows. We also want to activate observation window (Watch Window), in which we can observe the changes made to the state parameters. A full explanation of this element is available in the section entitled “Observation window”, in this documentation.

    Setting a breakpoint

    Take a look at the program and you will notice that it is locked in a repeating loop. So it's a good idea to set a breakpoint at the beginning of this loop before you start. You can do this by highlighting the line (at addresses 0005 and 000E) with the mouse and then pressing F9. Then press F12 to run the program. You will now see a message in the status bar indicating that the digital breakpoint has been reached, as well as the address of the program counter. It corresponds to the address of the first point we installed.

    A list of debug keys can be found in the menu Debug, but we will mostly use F11 to debug the program step by step. Now press F11 and notice that the red arrow on the left has moved down to the next instruction. We actually executed the ' clrw ' instruction and then stopped. You can check this by looking at the W register in the register window and noticing that it is cleared.

    Now we need to determine what should happen when the next instruction is executed, and then check whether it actually happened. For example, the following instruction moves the contents of register “W” to PORT A, i.e. PORT A will be cleared. Running this instruction and checking the register window confirms that this is in fact the case. Continue in this manner until we reach our second breakpoint, notice that both ports are configured to output (as specified by the TRISB register) and are set to zero.

    And so, we stopped at calling a function, we have the option of stepping through functions ( Stepping Over) (by pressing the F10 key), but for completeness we will walk through each instruction. Pressing F11 here takes you to the first line of the getmask function that is executed. Stepping forward, we see that the move operation was successful and that we are in the right place to add a zero offset to our lookup table. Therefore, when we return to the main program, we have the “mask” we expected. Taking the next step and writing the mask to the port, we can see the correct result in the diagram. Another step to increment the mode is also successful, as evidenced by the register window, where the value in the W register has increased by 1.

    The next step contains an instruction designed to sweep the mode to zeros when it increases above 3. This, as can be seen from the lookup window, does not happen. Obviously, the mode has increased to 1 here, which corresponds to the mask and is true for the next execution of the loop.

    Finding the error

    Hidden analysis shows that the cause of the problem is a bitwise AND with a four instead of a three. The modes we want are 0, 1, 2, 3 when bitwise AND them with 4 gives 0. This is why when the simulation is run, the traffic light mode does not change. The solution is to simply replace the problematic AND instruction with 3 instead of 4. This means that the mode is increased to 3, and when the W register increases to 4, the mode will be reset to zero. An alternative solution is to check when 'W' increases to 4 and reset it to zero.

    This section was translated from Proteus Help version 7.2

    Share with friends or save for yourself:

    Loading...