Solution Manual for Introduction to Mechatronic Design Do Not Circulate
Chapter 6 Software Design
6.1) Describe three ways in which programming is different than writing prose.
6.2) Describe three ways in which programming is similar to building a house.
6.3) Define decomposition in the context of software design.
6.4) True or False: Coupling is a desirable characteristic between modules.
6.5) True or False: All functions in a module should be represented in the public interface to the module.
6.6) Write a pseudo-code test harness for the Morse Elements module described in Section 6.5.6.2.
Print a message to the screen announcing that we are testing
InitializeMorseElements()
Call InitializeMorseElements()
If the state of the appropriate bit in the DDR is not correct
InitializeMorseElements()
Print a message to the screen announcing that we are testing
CheckMorseEvents()
With a legal Morse code signal applied to the input test
CheckMorseEvents:
Do
Until return value is WordSpaceDetected
Print a message that a word space was detected
Print a message to the screen announcing that we are finished testing
CheckMorseEvents()
Print a message to the screen announcing that we are testing
MorseElementsSM()
Print a message to the screen announcing that we are testing
StartCalibration()
Call StartCalibration()
If the value of CurrentState is not correct
6.7) Describe the function of a test harness in the context of an individual module.
6.9) Using the pseudo-code from Section 6.5.6.2, write code in a real programming language to implement the
InitializeMorseElements function.
In C for the MC9S12C32:
}
6.10) Write code in a real programming language to implement the following snippet of pseudo-code:
For every element in the array
multiply the element value by Gain and add the result to the running sum