Question
WHAT MORE DO YOU NEED?!?! *bE SpEciFiC* Use this code as a guide for D12PU Board: Using the code above as a guide - Write
WHAT MORE DO YOU NEED?!?!
*bE SpEciFiC*
Use this code as a guide for D12PU Board:
Using the code above as a guide - Write a C program to flash the eight small LEDs on the HSC12 board with the following patterns. You need to use RTI interrupts
.
(a) Turn on all LEDs for about 0.4s and turn them off also for about 0.4s.
(b) Repeat step (a) three more times.
(c) Turn on one LED at a time from left to right with each LED turned on for about 0.4s.
(d) Repeat step (c) three more times.
(e) Turn on one LED at a time from right to left with each LED turned on for about 0.4s.
(f) Repeat step (e) three more times.
(g) Go to step (a) and repeat.
#include "hes 12.1" #include "delay.h" void SetClk8(void); char hiOrlo; void main(void) { SetClk80: hiOrlo = 0; DDRT = 0x20; // configure PT5 pin for output PTT = 0x20; // pull PT5 pin to high RTICTL =0x40; // set RTI timeout interval to about 1 ms CRGINT =RTIE; // enable RTI interrupt asm("cli"); while(1); } 1/ RTI interrupt service routine interrupt void itiISR(void){ CRGFLG = 0x80; // clear RTIF flag if(hiOrlo) { hiOrlo = 0; PTT = 0x20; // pull pin high } else { hiOrlo = 1; PTT &=0xDF; // pull pin low } void SetClk8 (void) { SYNR = 0x02; // set SYSCLK to 24 MHz from a 4-MHz oscillator REFDV = 0; // PLLCTL = 0x60; // tum on PLL, set automatic while(!(CRGFLG & LOCK)); CLKSEL - PLLSEL: // clock derived from PLL } III/Part below is in file vectors.c extern void near rtilSR(void): #pragma CODE_SEG_NEAR_SEG NON_BANKED #pragma CODE_SEG DEFAULT // Change code section to DEFAULT. typedef void ("near IstFunc)(void): const tisrFunc _vect[] @0xFFF0 = { rtilSR }; #include "hes 12.1" #include "delay.h" void SetClk8(void); char hiOrlo; void main(void) { SetClk80: hiOrlo = 0; DDRT = 0x20; // configure PT5 pin for output PTT = 0x20; // pull PT5 pin to high RTICTL =0x40; // set RTI timeout interval to about 1 ms CRGINT =RTIE; // enable RTI interrupt asm("cli"); while(1); } 1/ RTI interrupt service routine interrupt void itiISR(void){ CRGFLG = 0x80; // clear RTIF flag if(hiOrlo) { hiOrlo = 0; PTT = 0x20; // pull pin high } else { hiOrlo = 1; PTT &=0xDF; // pull pin low } void SetClk8 (void) { SYNR = 0x02; // set SYSCLK to 24 MHz from a 4-MHz oscillator REFDV = 0; // PLLCTL = 0x60; // tum on PLL, set automatic while(!(CRGFLG & LOCK)); CLKSEL - PLLSEL: // clock derived from PLL } III/Part below is in file vectors.c extern void near rtilSR(void): #pragma CODE_SEG_NEAR_SEG NON_BANKED #pragma CODE_SEG DEFAULT // Change code section to DEFAULT. typedef void ("near IstFunc)(void): const tisrFunc _vect[] @0xFFF0 = { rtilSR }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started