Page 36 - ARM Based Microcontroller Projects Using MBED
P. 36

22                 2. MICROCONTROLLER-BASED PROJECT DEVELOPMENT CYCLE

                 • Program development tools
                 • PDLs
                 • Flow charts


                                                 2.5 EXERCISES


                  1. What are the advantages and disadvantages of flow charts?
                  2. It is required to write a program to calculate the sum of even integer numbers from 1 to 10.
                     Draw the flow chart to show the algorithm for this program.
                  3. Write the PDL statements for exercise (2) above.
                  4. It is required to write a function to calculate the area of a cylinder given its radius and
                     height. Draw flow charts to show how this function can be implemented. Also, draw a
                     flow chart to show how the function can be called from a main program to calculate the
                     area of a cylinder whose height is 2.5cm and its radius is 3cm.
                  5. Draw the equivalent flow chart for the following PDL statements:
                             BEGIN
                                   DO 10 times
                                         Turn ON relay
                                         Wait 1 second
                                         Turn OFF relay
                                         Wait 1 second
                                   ENDO
                             END
                  6. A push-button switch is connected to a microcontroller input ports. Also, an LED is
                     connected to an output port. It is required to flash the LED three times when the button is
                     pressed. Draw a flow chart to show how the program can be designed.
                  7. Write the PDL statements for exercise (6) above.
                  8. It is required to write a function to convert meters to inches. Draw a flow chart to show
                     how this function can be designed. Also, draw a flow chart to show how the function can
                     be called from a main program to convert 5m to inches.
                  9. Write the PDL statements for exercise (8) above.
                 10. A temperature sensor chip is connected to an input port of a microcontroller. At the same
                     time an LCD is connected to the output ports. Write a program to read the temperature
                     every minute and then display it on the LCD both in degrees Fahrenheit and in degrees
                     Centigrade.
                 11. Draw the flow chart equivalent of the following PDL:
                             BEGIN
                                   Configure the output port
                                   IF switch 1 is pressed THEN
                                         Start the motor
                                   ELSE IF switch 2 is pressed THEN
                                         Start the pump
                                   ELSE
                                         Turn ON the LED
                                   ENDIF
                             END
   31   32   33   34   35   36   37   38   39   40   41