There are two parts to this assignment. For the coding component Part 1, you are allowed to work in small groups (preferably 2 but up to 3) and turn in the same code.  ALL group members names must be on any shared code file (so all deliverables for Part 1). For the problem set in Part 2, you must turn in your own solution.

Part 1 (20 points)

Your Raspberry Pi Pico is a popular device with considerable documentation and many tutorials available. You will use some of these to complete this assignment.

  1. Follow Chapters 1, 2 and 3 in the RP Pico Getting Started guide to setup your system. NOTE: you do not need to use VS Code as the guide shows, but it is the recommended method for this class. Guide: https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf
  2. Follow the blink example in Chapter 4 and/or the GitHub repo (https://github.com/raspberrypi/pico-examples/tree/master/blink) to make the built-in LED blink. Then modify your code for Deliverable A below.
  3. Deliverable A: Using C and the Pico SDK introduced above, make the built-in LED blink in a pattern 100ms on, 100ms off, 100ms on, 700ms off. You should see two rapid blinks, then a pause. Turn this code in to Blackboard as “deliverable_a.c”. (10 points)
  4. Create a new a new project in VS Code for the next deliverable. Connect an LED to your RP Pico. Any color or type is ok, including using an LED on the breadboard in the kit. If you purchased the kit, you can follow Project 2 to do this. Write code to make this LED blink like in Deliverable A, then modify it as defined by Deliverable B below.
  5. Deliverable B: Use your LED to count from 1 to 5. Write code so that the LED blinks 100ms on, 200ms off for the count that it is on. For example, count 3 would look like on 100ms, off 200ms, on 100ms, off 200ms, on 100ms. Pause 700ms before moving to the next number. Use a for or while loop to control your LEDs, do NOT hardcode 1-5. Turn this code in to Blackboard as “deliverable_b.c”. (10 points)

Part 2 (10 points)

Answer the following questions and turn in the solution as “deliverable_c.pdf” to Blackboard.

  1. What are the four components of the status register on the RP2040? Describe what each of them does. (4 points)
  2. State the contents of the status register (the value of each of the four bits) after each of the following snippets of assembly code are run. If information beyond that in the slides is needed, consult the instruction definition in Section A6.7 in the ARMv6-M Architecture Reference Manual https://developer.arm.com/documentation/ddi0419/latest/ (6 points)
    1. MOVS R0, #0
      MOVS R1, #1
      SUBS R1,R0
    2. MOVS R0, #0xFFFFFFFF
      MOVS R1, #1
      ADDS R1,R0
    3. MOVS R0, #0x7FFFFFFF
      MOVS R1, #1
      ADDS R1,R0
    4. MOVS R0, #0
    5. MOVS R0, #0xAAAAAAAA
      ASRS R0,R0,#1
    6. MOVS R0, #0xAAAAAAAA
      MOVS R1, #1
      RORS R0,R0,#1