C Programming Only Goal : To become familiar with using subroutines, loops, inst
ID: 3842481 • Letter: C
Question
C Programming Only
Goal: To become familiar with using subroutines, loops, instruction cycles and timing, ports B, J and P as well as to become familiar with Dragon12-Light boards and improve your programming skills.
Project: Read the Dragon12-Light board User’s Manual on seven segment display. Compile, download, and test your program. Be sure you understand how it works. Then, write a C program to display a set of words/numbers in four different ways (or four different patterns).
Your program must have the following two display patterns:
Flash four characters/numbers at once (think of a blinking light) for six times.
Present characters/numbers one at time in succession on all four units for six times.
Explanation / Answer
#include /* common defines and macros */ #include "derivative.h" /* derivative-specific definitions */ void MSDelay(unsigned int); void main(void) { /* put your own code here */ DDRB = 0xFF; //PORTB as output since LEDs are connected to it DDRJ = 0xFF; //PTJ as output to control Dragon12+ LEDs PTJ=0x0; //Allow the LEDs to display data on PORTB pins for(;;) { PORTB = 0x55; MSDelay(500); //1/2 sec delay PORTB = 0xAA; MSDelay(500); } } //millisecond delay for XTAL=8MHz, PLL=48MHz //The HCS12 Serial Monitor is used to download and the program. //Serial Monitor uses PLL=48MHz void MSDelay(unsigned int itime) { unsigned int i; unsigned int j; for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.