Книга: Introduction to Microprocessors and Microcontrollers

The hardware

The hardware

Let’s keep it really simple. We have to buy a microcontroller and connect it up and then program it.

The device that we are going to use is a PIC16F84A-04/P. The pinout is shown in Figure 16.1. The number PIC16F84A is the type of microcontroller. The 04 tells us that the maximum frequency is 4 MHz and the /P means that it is the standard plastic package. There is no minimum operating frequency and the slower it runs, the less power it consumes.


Figure 16.1

Figure 16.2 shows the most basic circuit. It includes only the chip supplies and a positive supply to prevent the MCLR (master clear) from for a real project accidentally resetting the PIC during the program. Unless they are tied to a definite value all disconnected inputs will float up and down and can cause random switching.


Figure 16.2

We need a clock signal and the simplest and cheapest is just an RC combination. The resistor should be between 5 k? and 100 k? and the capacitor should be greater than 20 pF. The values chosen for this circuit were not selected carefully and are not critical. In practice, it is difficult to predict the operating frequency of an RC combination. If we need a particular frequency it is better to use a variable resistor and adjust it to give the desired frequency.

Later on, when we have written the program we must tell the assembler what clock signal we are going to use. This programs the PIC to expect an RC oscillator. This information can, as an alternative, be included into the program. It’s our choice but it is slightly easier to do it at the assembly stage but we must remember to do it.

Оглавление книги


Генерация: 0.600. Запросов К БД/Cache: 2 / 0
поделиться
Вверх Вниз