Книга: Advanced PIC Microcontroller Projects in C

5.5 Exercises

5.5 Exercises

1. Describe the phases of the microcontroller-based system development cycle.

2. Describe briefly the microcontroller development tools.

3. Explain the advantages and disadvantages of assemblers and compilers.

4. Explain why a simulator can be a useful tool while developing a microcontroller-based product.

5. Explain in detail what a device programmer is. Give some examples of device programmers for the PIC18 series of microcontrollers.

6. Describe briefly the differences between in-circuit debuggers and in-circuit emulators. List the advantages and disadvantages of both debugging tools.

7. Enter the following program into the mikroC IDE and compile the program, correcting any syntax errors. Then, using the software ICD, simulate the operation of the program by single-stepping through the code, and observe the values of the variables during the simulation.

/*=====================================
         A SIMPLE LED PROJECT
This program flashes the 8 LEDs connected to PORTC of a PIC18F452
microcontroller.
=====================================*/
void main() {
 TRISC = 0; // PORTC is output
 do {
  PORTC = 0xFF; // Turn ON LEDs on PORTC
  PORTC = 0;    // Turn OFF LEDs on PORTC
 } while(1);    // Endless loop
}

8. Describe the steps in using the mikroICD in-circuit debugger.

9. The following C program contains some deliberately introduced errors. Compile the program to find and correct the errors.

void main() {
 unsigned char i,j,k
 i = 10;
 j = i + 1;
 for(i = 0; i < 10; i++) {
  Sum = Sum + i;
  j++
 }
 }
}

10. The following C program contains some deliberately introduced errors. Compile the program to find and correct the errors.

int add(int a, int b) {
 result = a + b
}
void main() {
 int p,q;
 p = 12;
 q = 10;
 z = add(p, q)
 z++;
 for(i = 0; i < z; i++) p++
}
}

Оглавление книги


Генерация: 0.036. Запросов К БД/Cache: 0 / 2
поделиться
Вверх Вниз