More PIC Applications:12F675 Temperature Controller and PIC C Programming

12F675 Temperature Controller

The 10 and 12 series of PIC mini-chips offer a minimal set of features in eight-pin packages. The pin-out for the 12F675 illustrates the point (Figure 13.10). It can be configured with six plain digital I/O pins, but also offers two timers, an analogue comparator or four analogue input channels. The 12F629 is the same, except that it does not include the ADC and is therefore a little cheaper. An internal oscillator and in-circuit programming are also available.

A temperature controller could be implemented using this chip if only two analogue inputs are used (Figure 13.11). It could operate with a fixed set temperature, or another analogue input could be used as a set temperature input. With no display, a dial on the set temperature pot may be useful.

PIC C Programming

The 18 series are the most powerful of the 8-bit PIC microcontrollers. The group offers a large selection of different combinations of advanced 8-bit features, and the larger memory size means that ‘C’ can be used for application programming, instead of assembler. The instruction set of 75 16-bit instructions is designed to support this option. New low-power consumption devices are being added to this range all the time.

PIC Microcontrollers-1331

Comparison of 16 and 18 Series PICs

A small selection of the available 18F devices is included in Table 12.2. The architecture is somewhat more complex than the 14-bit devices, with extra blocks for multiplication,

a hardware data table access, additional file select registers and other advanced features. However, the data bus is still 8 bits. Taking the 18F4580 as an example, in terms of peripheral features it is comparable to the 16F887 described in Section 13.1, so a comparison of the two devices will be made to illustrate the differences and similarities of the two groups (Table 13.4).

As can be seen, the 18 series device has some advantages: 40 MHz clock rate, 16k program memory and more data memory. However, bear in mind that a program written in C will not be as code efficient as an assembly language equivalent, so these advantages may or may not translate into faster performance, depending on the application and the way that it is structured. The main advantage is that more complex operations, such as mathematical functions, are easier to program in C. For example, the conversion of binary temperature readings to two-digit BCD will be much easier in the temperature controller above. The 18 series PIC has a richer instruction set, including instructions such as multiply, compare and skip, table read, conditional branch and move directly between registers, so still has advantages even when programmed in assembly language.

Leave a comment

Your email address will not be published. Required fields are marked *