Chapter 17 The Board Simulator
The ENGS 28 board simulator, which we built for this course, runs the same register-level C as your Nucleo, right in your browser. It shows a simulated board with its on-board LED, its blue user button and its header pins, so you can get the logic of a program right without any hardware. Wherever an exercise in this book can be done in the simulator, a link beside it opens the simulator in a new tab with that exercise’s code loaded. The simulator below opens with a plain Blinky, the program we started the course with, and the examples list above the editor loads the other programs we use in the course, in the order we use them.
Press Run to run the program and watch the simulated board, or Step to walk it one line at a time. The register panel shows each register your program uses once the program reaches it, so you can watch the bits change as your code runs.
The on-board LED on PA5 and the blue user button B1 on PC13 are already on the simulated Nucleo. External parts come from the component bay: click + LED, + Button or + Pot, then click the Arduino header pin you want to attach it to. Hold a button down to press it, and drag a potentiometer’s knob to turn it. Parts are not carried from one tab to the next, so attach them again each time you open a link.
The panel below the editor is a stand-in for CoolTerm:
printf output arrives there, and clicking it lets you type back to the board. It opens by itself the first time your program transmits, and the CoolTerm button (the keyboard icon) shows or hides it.
The simulator does not save your code. If you reload or close the tab your work is gone, so use the download button (the downward arrow at the end of the row above the editor) to keep a copy on your own computer.
