Limitations of Software Simulation
The simulator allows the program logic to be tested before running the program in the actual hardware, to ensure that it is functionally correct. However, the simulation is cannot be 100% realistic, and its limitations need to be taken into account in testing the real system. The following is given as an example of the kind of problem that might easily be missed, but seriously affects the operation of the application, and would compromise safe operation of the real system if a more powerful motor were used.
The data sheet for the 16F84A shows that the state of the port A bits is unknown after a power-on reset. Therefore, the motor output may come on during the power-on timer phase, before the program starts executing. This is obviously a potential problem, which is only partially addressed by following the port initialization instructions with one to clear the motor output bit. There could still be an on pulse to the motor before the start of the program. If this caused a problem in practice, a suitable fix would be needed; for example, a separate fail-safe contactor in the power circuit that ensured that the motor was not powered up until the controller had been successfully started, which is probably desirable in any case.
Hardware Testing
The test procedure looks very detailed when written down, but in practice it does no more than test all the features of MOT1. It can be converted to workbook stimulus sequence as indicated in the previous section. The software product needs to meet the specification only once, in prototype hardware. Once the software is proved, the hardware in the production units can be tested in conjunction with firmware (final ROM program) that is known to be correct. A similar test schedule could be used to test each unit, using an oscilloscope to monitor the output waveform at RA0. It would then be useful to measure the actual resulting motor speed for the range of output duty cycles generated (the motor will typically not run below a minimum MSR). Alternatively, a special test program could be written to exercise the hardware, before downloading the working version.