Question: Give a code not others things and if you cant help dont do it Pick and implement one of the two blinking patterns below: 1
Give a code not others things and if you cant help dont do it
Pick and implement one of the two blinking patterns below:
Holiday Blinky simpler coding task for reduced number of points pts:
Use periodic interrupts generated by Timer BB zero to make the LEDs to twinkle in a simple
alternating pattern: when the green LED is on the red one should be off and vice versa.
For this task, you do not need to implement a state machine.
Waltzing Blinky twinkling LEDs with a state machine pts
The waltz is a ballroom dance with a rhythm pattern with an accent on the first beat. Use
periodic interrupts generated by Timer BB zero to make the LEDs waltz by blinking red
greengreenredgreengreen... How? Make the red LED blink once followed by two blinks of
the green LED and repeat this pattern indefinitely.
For both tasks:
Please watch the short demo video posted to Carmen exhibiting the desired behaviors.
While the LEDs are twinkling, the MCU is in low power mode LPM
The LEDs are turned on and off while serving interrupts generated by Timer B you are
not allowed to utilize any software generated delay loops.
Start by downloading the corresponding asm file from Carmen. In both files, I have already
configured Timer B to throw periodic interrupts only the frequency is different, faster for the
waltz You will write an ISR that services these interrupts. Make sure that your ISR does not
modify any core registers.
The memory address for the Timer B interrupt vector is xFFF The interrupt flag is bit TBIFG
in the bit register TBCTL Make sure to test and clear the TBIFG bit only DO NOT clear
the entire TBCTL register since it holds information that is critical for the correct operation of
Timer B
The holidayblinky code: ;
; MSP Assembler Code Template for use with TI Code Composer Studio
;
;
;
cdecls CLIST,"msph ; Include device header file
;
def RESET ; Export program entrypoint to
; make it known to linker.
;
text ; Assemble into program memory.
retain ; Override ELF conditional linking
; and retain current section.
retainrefs ; And retain any sections that have
; references to current section.
;
RESET mov.w #STACKEND,SP ; Initialize stackpointer
StopWDT mov.w #WDTPWWDTHOLD&WDTCTL ; Stop watchdog timer
;
; Main loop here
;
; Configure Timer B to throw periodic interrupts
bis.w #TBCLR &TBCTL ; reset timer
bis.w #TBSSELACLK, &TBCTL ; source is ACLK
bis.w #MCCONTINUOUS, &TBCTL ; continuous mode
bis.w #CNTL &TBCTL ; counter length bits
bis.w #ID &TBCTL ; divide freq. by
bis.w #TBIE, &TBCTL ; enable interrupts
; Add your code here
;
; Interrupt Service Routine
;
TBISR:
; Add your code here
;
; Stack Pointer definition
;
global STACKEND
sect stack
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
