Книга: Advanced PIC Microcontroller Projects in C

The COLLECTOR Processor 

The COLLECTOR Processor 

The COLLECTOR processor consists of a PIC18F258 microcontroller with a built-in CAN module and an MCP2551 transceiver chip. The microcontroller is operated from an 8MHz crystal. The MCLR input is connected to an external reset button. Analog input AN0 of the microcontroller is connected to a LM35DZ-type semiconductor temperature sensor. The sensor can measure temperature in the range of 0°C to 100°C and generates an analog voltage directly proportional to the measured temperature (i.e., the output is 10mV/°C). For example, at 20°C the output voltage is 200mV.

The CAN outputs (RB2/CANTX and RB3/CANRX) of the microcontroller are connected to the TXD and RXD inputs of an MCP2551-type CAN transceiver chip. The CANH and CANL outputs of this chip are connected directly to a twisted cable terminating at the CAN bus. The MCP2551 is an 8-pin chip that supports data rates up to 1Mb/s. The chip can drive up to 112 nodes. An external resistor connected to pin 8 of the chip controls the rise and fall times of CANH and CANL so that EMI can be reduced. For high-speed operation this pin should be connected to ground. A reference voltage equal to VDD/2 is output from pin 5 of the chip.

The program listing is in two parts: the DISPLAY program and the COLLECTOR program. The operation of the system is as follows:

• The DISPLAY processor requests the current temperature from the COLLECTOR processor over the CAN bus

• The COLLECTOR processor reads the temperature, formats it, and sends to the DISPLAY processor over the CAN bus

• The DISPLAY processor reads the temperature from the CAN bus and then displays it on the LCD

• This process is repeated every second

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


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