Performing arithmetic operations

Writing a program that adds two numbers together may seem like a trivial task. We obviously need to declare three variables, two to hold values of the numbers to be added, known as addends, and another to hold the sum. The following recipe illustrates some problems that arise due to word length.

How to do it…

The following steps demonstrate how to perform arithmetic operations:

  1. Create a new folder and name it addTwoNums_c3v0. Invoke uVision5 and create a new project named addTwoNums within this folder.
  2. Use the RTE manager to select the MCBSTM32F400 evaluation board and configure it as we did for helloWorld_c2v0, from the Writing to console Window recipe in Chapter 2, C Language Programming.
  3. Copy the files, Serial.c ...

Get ARM® Cortex® M4 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.