Answers

1. Musical birthday card, electronic price tag, sound system, television, automobile, robot.

2. Input, ROM, CPU, RAM, output.

3. Flash ROM is non-volatile but reprogrammable, so the program can be changed or the chip reused. Program testing and modification is easier and development time is reduced compared with alternative types of program memory.

4. Number of I/O pins, program memory size, RAM size, EEPROM size, maximum clock speed, range of interfaces, development system, cost, availability.

5. The program is stored as machine code instructions, executed in sequence. The instruction register holds the current instruction and the program counter holds its address. The file registers store the program data and the working register the data being operated on.

6. 02=Program Counter Low Byte.

03=Status Register.

09=Port E Data Register.

89=Port E Data Direction Register.

20=General Purpose Register 1.

7. RC=clock uses resistor/capacitor circuit to control clock frequency.

XT=clock uses crystal circuit to control clock frequency.

WDT=watchdog timer provides automatic reset if program hangs.

PUT=power-up timer delays the program start until the MCU is ready.

NOWRT=prevents writes to program memory areas.

8. Tristate gate=data switching circuit allows data through only when enabled; otherwise, output is high impedance.

Current driver=provides extra current on a loaded data line.

Data direction latch=stores the bit that sets the port bit as input or output.

Input data latch=stores the incoming bit when the port line is set to input.

Output data latch=stores the outgoing bit when the port line is set to output.

9. 20-MHz clock → 5-MHz instruction clock → 200-ns period.

10 ms=10,000,000 ns.

Timer count required=10,000,000/200=50,000 instruction clock cycles.

Maximum count of 16-bit timer=65,536.

Preload value=65,536−50,000=15,536.

10. Resolution=2048/256=8 mV per bit.

Output=(1000/2048)×256=125=0 + 64 + 32 + 16 + 8 + 4 + 0 + 1

0111 11012.

11. The timer interrupt is set up at the beginning of the program. The timer is started at some point in the program and runs concurrently with program execution. When a time-out occurs, the program is suspended and the interrupt service routine carried out. The program is then resumed at the original point. Interrupts allow the timer to independently generate an accurate interval between the timer start and interrupt request.

12. See the figure.

13. RS232 is asynchronous, in that it has no separate clock signal. Instead, the reception is resynchronized by each start bit, and reception is timed by a local clock. SPI has a separate clock (used to strobe each bit into the receiver, generated from the master MCU clock) and is therefore classed as a synchronous system.

14. SPI needs a hardware chip select signal connected to each slave, which the master takes low to enable one slave receiver at a time. I2C transmits the target address on the data line; the slave must check all transmissions and pick up the data that follow its own address.

15. I2C has to send addressing and control information as well as the data on the data line, while SPI has hardware slave selection.

16. RS232=9600 baud ≈ 10k bits/sec ≈ 1k bytes/sec ≈ 1000 characters/sec →Page time ≈1 sec. SPI=5-MHz clock → 0.2 μs/bit → 2 μs/character (some loading delay) → Page time ≈ 2 ms.

17. C=source code entered via a text editor.

HEX=hexadecimal code (machine code) program.

COF=downloading file that contains the hex code plus debugging information.

LST=list file, a text file containing source code, hex code, comments, etc.

ERR=error file that lists the error messages generated by the compiler.

18. Vss=0 V, Vdd=+5 V=supply connections.

Vpp=programming voltage (+14 V); !MCLR=Master Clear resets MCU.

PGD=program data download; PGC=programming clock signal.

19. Project file=shows the files used to make the project.

Source code=edits window for entering program.

Disassembler list file=shows the assembler code generated from the C source code.

Output message=shows the compiler status and errors.

Watch=variable values monitored during program execution.

20. Host PC, MPLAB development system, C compiler, programming module+connectors, target system with PIC MCU.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.83.7