2. Number Systems and printf
2.1. Purpose
This activity is intended to provide a hands-on demonstration of number systems as used by a processing platform. This activity also serves to give an introduction to printing text and variable values from the microcontroller to the serial terminal; a skill useful in debugging systems throughout the course.
2.2. Hardware and Tools
None
OR
MSP-EXP432P401R Launchpad Development Board, OR
TI-RSLK Robotic Car
2.3. Description
This activity is composed of two parts:
Programming tasks towards understanding of how numbers are handled by the microcontroller and how to use
printf()
statements in C.A set of number conversion tasks given on Gradescope.
2.4. Instructions
You have two options for completing this Activity:
[Preferred] Perform all steps within CCS; which will require being connected to a Launchpad Board or RSLK, or
Perform all steps within an online (or local) C IDE/compiler. This will not require hardware but will of course be a different environment than CCS.
2.4.1. CCS Option
Download the CCS project from here:
activity_numsys.zip
, and import into CCS. For instructions on how to do so, see 3. Test Project.Once imported, open the main.c file and read the comments and code within the file thoroughly. When done reading, connect either the RSLK or the Launchpad Board to your computer and start a serial terminal connection.
Verify the project works properly:
Compile the current project by pressing on the “hammer” icon, , on the top toolbar, or by selecting Project → Build Project. No errors should result from this; if there are, ask for some help!
Load the project onto the MSP432 (the microcontroller on the RSLK or Launchpad Board) by pressing the “debug” icon, , on the top toolbar (green beetle) or by selecting Run → Debug.
This should bring up the Debug Perspective, .
Run the code by clicking the “Resume” button, , or by selecting Run → Resume.
This should cause output to be generated on the terminal window. Make sure this is the case.
Continue the activity with the Shared Instructions.
2.4.2. Online Option
Download the template code from here:
Activity-NumberSystems.c
. Open the file, copy the contents of the file and paste it into an online C IDE/compiler. Three examples of these are given below; however, there are many to choose from if you search “online c compiler”.Verification of Correct Project Operation: Test the online compiler and the pasted code by telling the compiler to compile and run the code. This is typically done by clicking a “Run” or “Execute” button. A simplistic output should be generated in the “Output” or “Result” panes. If an error is reported, ensure that the code was pasted properly and try again.
Continue the activity with the Shared Instructions.