4.11 Exercises

1. Write a C program to set bits 0 and 7 of PORTC to logic 1.

2. Write a C program to count down continuously and send the count to PORTB.

3. Write a C program to multiply each element of a 10-element array with number 2.

4. It is required to write a C program to add two matrices P and Q. Assume that the dimension of each matrix is 3 × 3 and store the result in another matrix called W.

5. Repeat Exercise 4, but this time multiply matrices P and Q and store the product in matrix R.

6. What is meant by the terms “variable” and “constant”?

7. What is meant by program repetition? Describe the operation of while, do-while, and for loops in C.

8. What is an array? Write example statements to define the following arrays:Tr

Get SD Card Projects Using the PIC Microcontroller now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.