In Wisebatt, the Behavior describes how your device is going to work. More specifically, how your microcontroller unit executes instructions and interacts with the components that are present in your design, over a specific period of time.
In the Behavior interface you can draw with block diagrams (functional diagrams) a representation of the algorithm that your device will use.
Please note that each time there is a change in the schematics (connections between components), it can result in a different set of instruction blocks.
How to draw the Behavior of your device.
In Behavior you need to describe how your device will function from start to end. You need to describe all the possibilities that can happen. Ask yourself - what will your device do?
Write down all the steps that your device will go through and how it will use all the components you put in the design space.
Each box is representing a state or operation. Take them from the Library, align them, connect them.
4 steps to remember :
- Start with the START block;
- Select the actions that you wish your device to do;
- Use the IF for conditional statements.
- Don’t forget to make a loop at the end.
Use a loop so that your program can repeat itself until your device stops working.
As mentioned, each hardware design will result in a specific set of instruction. However, there are common instructions that you will find in every situation.
Starts the simulation. This is the entry point of your algorithm. The START box is mandatory to make your algorithm function.
IF (Define Logic Test)
This is a conditional state used to build tests. Double click on the "Define Logic Test" box to start defining it.
Connect your logic test to other instructions. Connections from the side are for FALSE results. Connections from the bottom are for TRUE results.
Creates a variable that you can reuse elsewhere in your Behavior. Double click on the "Create Variable" box once it's on the Design Space to start defining it.
Wait for Response
Used after a “Read” instruction to wait for the components that have been asked to provide data.
Used to wait for a specific time. Double click on it to set its timer.
Define Arithmetic Operation (+,-,*, /,%)
Allows you to apply the specified operations to a variable. Double click on it to start defining it and specify the variable in which the result is stored.
Change MCU state
Request the MCU to switch to a specific state. This instruction also supports timing edition.
“Go to State”
Requests a component to go to a specific state.
Please note that modifying the hardware design in Schematics after having build a first Behavior may result in losing part of the algorithm (especially if the type of connection is changed, e.g. from SPI to UART, or if components are deleted from the Schematics).
A state timing is the time spent in each state.
Each instruction has its own timing which is not visually displayed in Wisebatt.
However some specific states and custom states will need you to define their timing to be representative of the algorithm that you want to design. For instance, for waiting time, use the “wait for” instruction and add the desired timing.
Usually the already defined timings are communication or “Go-to” states (low-power, sleep, active etc).
How to change the timing
Simply double click on an instruction box in the design space. A box opens.
Enter a number. Press Enter.
Apply a timing to an entire loop
It’s currently not possible to apply a timing to an entire loop. There is however a workaround : use the “Wait For” state (Processing Category) as the very last state before looping the algorithm.
Don’t forget to apply a timing to this state.
Once the design is finished, click on Results to launch the Compiler. The Compiler checks your design for any abnormalities. If your design is correct, the simulation will launch and you will access simulation results. If not, the Behavior Compiler box appears.
If you still have questions, please get in touch at firstname.lastname@example.org.