参数资料
型号: FACT002
英文描述: Fact 3 Documentation
中文描述: 事实3文件
文件页数: 1/4页
文件大小: 49K
代理商: FACT002
1996 Microchip Technology Inc.
FACT003-page 1
CARE AND FEEDING OF THE PIC16C74
AND ITS PERIPHERALS
By: Robert Angelo
The PIC16C74 is one of the latest mid-range
microcontrollers from Microchip Technology Inc. In this
article we will be addressing a few of the new features and
peripherals of this new part. The main focus will be on the
A/D
(Analog-to-Digital)
Converter,
Communication Interface, and the PWM-Pulse Width
Modulator. Our intention is to give you a small program that
initializes these peripherals as well as exercise them. A
schematic is provided. The PICDEM-2 board from
Microchip will run this program. The second trimpot does
not exist on the PICDEM-2 board, so the second A/D value
may float around. The second trimpot is only used to show
a method of changing A/D input pins. If you are using the
PICDEM-2 board, then the LED and a current limiting
resistor must be connected to the PWM output. When the
program is run, the RS-232 terminal will display two A/D
values. The brightness of an LED is adjusted using pulse
width modulation. The duty cycle is determined by the
trimpot setting.
Assumptions
Although dangerous, sometimes we need to make
assumptions. For this discussion on the PIC16C74, let us
agree that RA0 and RA1 will be connected through a series
resistor to the wipers on two potentiometers with the other
ends connecting across V
DD
and ground (see schematic).
The oscillator clock will be 4 MHz. First we'll read an A/D
input, send its result out the serial port (to be displayed on
a PC terminal program), and then switch to the next
channel. We will adjust the PWM output pulse width to
match the first potentiometer. Each time we are ready to
begin a new sequence we will first send a pair of sync bytes
to signal the receiving processor. To simplify our discussion,
we will forgo using interrupts and we will do this in a polled
fashion. The watch dog timer is disabled for this program.
To ensure there are no surprises, it is a good idea to
initialize every special function register (SFR) and data
register to some known value prior to use.
the
SCI-Serial
A/D Converter Mysteries
The A/D converter and its eight input channels will be our
first topic. Setting up the A/D converter involves two special
function registers:
ADCON0
ADCON1
In the program included with this article is a code segment
initad
that sets up the A/D. ADCON0 is the work horse
register for this peripheral. This register is used to select the
conversion clock frequency and channel. This register is
also where we signal the start of a conversion and detect
the completion of a conversion. ADCON1 has only one
purpose in life for this part, and that is A/D port
configuration. When ADCON1 is used it does not override
the TRISA register controls. The TRISA register must be set
up. Once these registers are set up, all the program has to
do is select the desired pin and set the GO/DONE bit in
ADCON0. The program then waits for the conversion
complete bit, GO/DONE, to be cleared by hardware. Then
the ADRES (A/D conversion result register) register is read.
The value from the first pot's conversion is then used to
adjust the PWM pulse width thereby adjusting the LED
brightness.
FIGURE 1:
PWM PULSE WIDTH
Duty
Duty
Period
Period
This document was created with FrameMaker 4 0 4
相关PDF资料
PDF描述
FADSFACT MPC860 and MPC850 Family Application Development Systems Facts Sheet
FALCON Series Regulators; Surface Mount Type: N; Package: TO-92; Number Of Pins: 3; Polarity: Positive; General Description: Three-Terminal Voltage Regulator; Features: Low current output; Note: Radial tape packing for automatic mounting; V OUT (%): (max +/-4)
FALL2003 High Efficiency Diodes (HEDs); Surface Mount Type: Y; Package: M-FLAT; Number Of Pins: 2; Application Scope: Switching mode power supply; Internal Connection: Single; T RR (ns): (max 35); Repetitive Peak Reverse Voltage V_RRM Max (V): (max 3); I O (A): (max 200)
FAN4113IS5 Voltage-Feedback Operational Amplifier
FAN4113IS5TR3 Voltage-Feedback Operational Amplifier
相关代理商/技术参数
参数描述
FACT-OR-MAINT-VXW-EP 制造商:Emerson Network Power 功能描述:MAINTENANCE FOR FACT-OR ON WTRB500 - Bulk
FACTORY CHARGES 制造商:Misc 功能描述:
FACTORY MODIFICATION 制造商:Teledyne Relays 功能描述:
FACTORYFLOOR 制造商:Opto 22 功能描述:Software, Factory Floor
FACTORYFLOOR MANUAL 制造商:Opto 22 功能描述:Manual, Factory Floor