Periodically interrupt using the OC subsystem to change the RGB LED color at a fixed rate of approximately 1 second. You must change the RGB LED color slow enough such that the human eye can see the color change. You must use the constants, variables, and pointers in the template. Create the following subroutines and an ISR in your assembly program:

• Main Assembly Subroutine

• Port 2 Initialization Subroutine

• RGB LED Out Subroutine

• NVIC_Init Initialization Subroutine

• Timer A1 Initialization Subroutine

• Timer A1 Interrupt Service Routine (ISR)

Main Assembly Subroutine

The subroutine must be named, “asm_main”. The main C program will call “asm_main” once and then loop forever, waiting for the next interrupt. In this subroutine, you need to call the initialization subroutines for Timer A1, NVIC, and Port 2.

Port 2 Initialization Subroutine

Name this subroutine, “Port2_Init”. Initialize Port 2 such that the onboard RGB LED is enabled. To do this, you will need to enable pins 0, 1, and 2 as GPIO outputs. Dont set all the pins of Port 2 are set to outputs.

RGB LED Out Subroutine

Name this subroutine, “LED_Out.” The table below shows how the color of the RGB LED can be controlled. Some examples:

• If you output “000”, where the LSB goes to P2.0 and MSB to P2.2, the LED will be black (off).

• If you output “001”, the LED will be red.

• If you output “101”, the LED will be purple.

• If you output “111”, the LED will be white.

• etc.

Blue (P2.2) Green (P2.1) Red (P2.0)

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

NVIC Initialization Subroutine

Name this subroutine, “NVIC_Init”. Enable interrupts for Timer A1. See the NVIC lecture to see how to initialize interrupts using the NVIC.

Timer A1 Initialization Subroutine

Name this subroutine, “TimerA1_Init”. See the OC lecture to see how to initialize the OC subsystem. You must use the ACLK (32.768 kHz).

Timer A1 Interrupt Service Routine (ISR)

The ISR must be named, “TimerA1_ISR”. When an interrupt occurs, the “TimerA1_ISR” ISR will be called from the C program. For every call to TimerA1_ISR, you need first to acknowledge the interrupt. If you don’t do this, the next interrupt will be ignored. The color of the RGB LED must change slow enough to be seen by the human eye. You can change the RGB LED by calling the “LED_Out” subroutine and passing a 3-bit value. Initially send “000” to the “LED_Out” subroutine to make the RGB LED black (off).one second later, send “001” to the “LED_Out” subroutine. increment the 3-bit value and output to the RGB LED about every second: 000, 001, 010, … , 110, 111, 000, 001, 010, …, etc. You will need to write code to handle the wrapping of the 3-bit string from “111” back to “000”.


You need to submit the demonstration video

Provide your code as text, not an image. The screenshot should show the relevant information (i.e., CPU registers, memory locations, etc.). screenshots in Windows is to use the “snipping tool.”

Screenshot Example



var1 .word 0


val1 .word 0x0000.00FFFFFFFF

var1_ptr .word var1

.global main

.thumbfunc main

main: .asmfunc ; main loop

ldr r0, var1_ptr

ldr r1, val1

str r1, [r0]



The first load (LDR) loads r0 with var1_ptr, which points register r0 to the memory location of var1. The value (val1) is loaded into r1, and then it is stored in memory (var1). Hence, in the screenshot, you need to show the contents of registers r0, r1, and var1 because this is what is affected. Show the contents of this register and memory address after the code has been executed. The screenshots should look similar to what is shown [login to view URL] r1 and memory address 0x0000.002000.0014 have the value [login to view URL] (val1) in them. r0 points to 0x0000.002000.0014, which is the location of var1. This confirms the program is working correctly.

Skills: Microcontroller, ARM, Assembly, x86/x64 Assembler, C++ Programming

See more: arm assembly, merge sort arm assembly, arm assembly code, electronic safe and arm device, safe and arm device definition, sorting in arm assembly, bubble sort algorithm arm assembly, bubble sort in arm assembly language, arm assembly language reference, arm assembly language programming in keil, arm assembly language fundamentals and techniques, arm assembly raspberry pi, arm assembly language pdf, arm assembly language fundamentals and techniques pdf, arm assembly language instruction set, arm assembly language book, convert c code to arm assembly, arm assembly projects, arm assembly language programming examples, arm assembly and

About the Employer:
( 630 reviews ) Bangalore, India

Project ID: #28290672

Awarded to:


Hi I have checked your files it's doable.I have 5 year experience in ARM language and embedded system projects .we can discuss in [login to view URL]

$50 AUD in 3 days
(5 Reviews)