Simulator in this version is made separately from the IDE, which is made into the file “SimulatorInDLL.dll”. This way you can develop a simulator in order to work in your favor.

Actually, this simulator only support assembly. But you can set limits to the simulator as if working for C. Condition, you need to know exactly how C make a program. This is possible if you are a multi-programmer, meaning not only understand microcontroller programming, but also other programming. You also need quite understand how the SDCC works. If not, you can only use the simulator for assembly.

Wait, do not worry, although the simulator is only able to work in assembly language, but Microcontroller Project will convert the program you are writing with SDCC into assembly. So your C program can be tested with the simulator. Well now we will discuss the use of simulators in general.

The SimulatorInDLL main menu
The SimulatorInDLL main menu

Seven main menu on the simulator:

  1. Start. Of course, this menu function is to run the simulation. This menu will change to Stop if it is running, so of course serves to stop the simulation.
  2. Single Step (F7). This menu function is to execute just one line of instructions.
  3. Step Over (F8). The menu is almost the same as Single Step. The difference appears if the executed instruction is a call instruction. Single Step will jump to the invoked subprogram, whereas Step Over will execute subprogram to its completion.
  4. Reset. This menu serves as we hit the reset button on the microcontroller circuit. Usually when you first run the simulator, you can not run the simulation until you click on this menu. Likewise, after you make changes to options.
  5. View. This menu serves to select a window which will be displayed. i.e window of internal RAM, external RAM, Ports, SFR, and Registers.
  6. Option. Well, this really must be considered in order to optimally use the simulator.
    • External Updates. If the menu is marked with a check, then any access to external ram will cause the contents of registers in the external ram windows will automatically be updated.
    • Update Display. If the menu is given a check mark, then every execution of the program will immediately cause all the windows updated. You should uncheck the menu if you want to see every change of the data on each program execution. But this will cause the speed of the simulation becomes much slower. So if you just want to see the final result or just want to see the work shown in the port, you should remove the check mark.
    • Separate 4-bit binary. Well if the menu is marked with a check, then the binary number on the window of port, sfr, registers, or external ram will be split in two nibble.
    • Com. Well this menu is very important menu if you are trying the program for serial communication. You can select COM1 through COM4 if you want any assignment to the SBUF register actually sent to the serial port on your computer. In addition you can also connect SBUF with other simulator through the window message. If you select this link, then the data loaded into the SBUF will be sent to the destination window with the data in wParam. First you must set the required parameters. The first is the handle of the target window. To fill this value, you simply click on the Capture Handle button, then point the mouse pointer to the destination window, then click on the window. Next is the Message to be sent. If the simulator window target need a WM_USER, then you simply click on the button to get the constants for the WM_USER. Likewise, if the window target want a WM_CHAR, then you simply click on the WM_CHAR button. You can use notepad to capture the character data sent via SBUF if it is a WM_CHAR message. The latter is the lParam. These parameters are not always used. This may be important if you make your own simulator and require additional information, such as if you also want your simulator to communicate directly with this simulator. You can just check the “Handle of this application” to get the handle of the running simulator. Of course this information will only be understood if you are accustomed to make a program in Windows.
    • Thread priority. Well, you have to carefully select them. If you choose the highest priority, then all the CPU time will be spent almost just to run this simulation. So sometimes you will even be difficult to move the mouse.
    • Port. Which is useful to set a link from P0 to P1. If you click on this menu, then you will be taken to a window to set the link of these ports. There are four options for each port link, i.e. link is none, if you don’t want to connect the port anywhere; link port, if you want to connect the port to physical ports, such as parallel port, PPI or other physical ports installed on your computer; link message, if you want to link the data on the port to the running application or to other simulators, and the last is the link file, ie if the data sent to the port will be sent to a file. Link message settings can be considered the same with the settings on COM link message.
    • Reset Port+Com setting on close. If the menu is marked with a check, then the settings on the port and com will be returned to the “link none” state after the simulation is closed. Conversely, the setting will be stored in the registry and will be used to set the simulator when the simulator is run again.
    • Simulation speed. This is the last menu in the Options menu. This will determine the delay of any simulated execution. Of course, this menu will only be meaningful if the Display Update menu marked with a check.
  7. About. Which is not so important, just sometimes when we make a program, then we also want to be known. Well if you click on this menu, you’ll see the logo of my pride.

Break point

There are times when we want to run the simulation without having to watch every step. We just want to know the circumstances of the particular line, eg state of the registers just before a subprogram return back (on the RET command). If so, you simply mark a break point on the line that you want as the cessation of the simulation. The trick, double-click on the line where you want the simulation to stop. To remove the break point, you just double click again on that line.

Update Point

If we want to run simulations quickly, then we must remove the check mark on the Option-Update Display menu. Unfortunately if we do, then all display at the windows will only be updated after we stop the simulation. So we can not observe the changes that occur in the registers. We can make so that at certain points, the values of registers will be updated without having to stop the simulation. Well, if this is what you want, then you can add the update point on certain line. For example on the line after a port is modified so that we can observe changes in the value of the port. The trick is to double click while pressing the Ctrl key on the line you want to add the update point.

Breakpoint and Updatepoint
Breakpoint (red) and Updatepoint (yellow)

13 Comments

Time limit is exhausted. Please reload the CAPTCHA.

Notify me of followup comments via e-mail. You can also subscribe without commenting.

    1. koding? maksudnya source code? ya ada lah, wong itu aku yang bikin. tapi aku ga membuat itu untuk publik, jadi aku ga mendokumentasikan dengan baik. cuma aku tulis dan aku pahami sendiri. kalo dll nya sih mang aku gratisin buat diambil siapa saja yang mau 🙂

    2. maaf.. maksud mas sulhan pada komentar di atas source code untuk buat file dllnya simulator y????
      boleh dong aq ambil kalo gk keberatan… :->

  • maz….saya pengen tanya….saat saya jalankan demo program running text ….kenapa di simulasi Mxled.exe gak nampil…tolong di kasih pencerahannya…..

    1. @Budiono: sudah download IDE terbaru kan? Nah, coba jalankan demo dari demo yang pertama hingga yang terakhir. Ikuti petunjuk yang ada di situ (baca help).

    1. @belajar elektronika: tidak sama, ini hanya menirukan kerja hardware secara software saja. meskipun demikian, percobaan2 yg berhubungan dg hardware sungguhan bisa jg dilaksanakan, misalnya komunikasi serial atau membaca atau mengirim data ke port.

  • Pak, tadi malam saya beli buku bapak. Kok simulator nya ini gak ada dalam CD ya? Kalau mau download dimana pak?

    Terimakasih 😀

  • salam pak sulhan,, saya sudah pernah menggunakan simulator yang ada dimikro7 dan bisa ( pd komputer saya ), tapi saya copy foldernya ke komputer lain kok pas buka mikro7 ada alarm simulatorInDll.dll not found, dan saya tidak bisa gunakan simulator di komputer tersebut.
    apa ada yang perlu di instal ya pak??
    makasi.