参数资料
型号: FACT002
英文描述: Fact 3 Documentation
中文描述: 事实3文件
文件页数: 2/4页
文件大小: 49K
代理商: FACT002
FACT003-page 2
1996 Microchip Technology Inc.
Pulse Width Modulation (PWM)
The PORTC-1 pin is used as the PWM output. The registers
that need to be set up for this PWM operation are:
TRISC
T2CON
CCPR2L
PR2
CCP2CON.
The code
initpwm
is an example of what might be done
to initialize the PWM module. TRISC was cleared earlier
thus setting PORTC as output. By writing a "4" to the
T2CON register, we will set the prescaler equal to 0 and
select TIMER2 operation. Writing a 0fh to the CCP2CON
register selects PWM mode and standard resolution. The
0fh written to the CCPR2L register sets the high period to a
low value initially. Setting the PR2 register to ffh allows the
CCPR2L value (from the A/D converter result) to approach
a 100% duty cycle. Now we can control the brightness of the
LED attached to this pin by adjusting the pot on pin RA0 and
writing the A/D result to the CCPR2L register as already
described earlier.
SCI
The Serial Communications Interface Module is our RS-232
communications channel. We will configure the SCI as an
asynchronous full duplex serial port. This is done with the
routine at
initsci
in the program provided. There are a
few fine points to remember relative to this peripheral. The
baud rate is determined by a dedicated eight bit baud rate
generator and can be used to derive standard baud rate
frequencies from the oscillator. Since we are not using
interrupts, there are only five registers to deal with:
RCSTA - receiver status
TXSTA - transmitter status
TXREG - transmit buffer
RCREG - receive buffer
SPBRG - to set the baud rate generator
FIGURE 2:
SERIAL COMMUNICATIONS
INTERFACE MODULE
First global interrupts are disabled. The
does the serial port setup and the
actual sending of the data.
The SCI is setup for 2400 baud, 8 data bits and 1 stop bit
with no parity. A terminal program, such as TERMINAL in
Windows“, set to the same settings can be used to see our
output. If you use the Windows terminal program, then set
the communications parameters to 2400 baud, 8 data bits,
1 stop bit, no parity and hardware handshake.
Tying The Pieces Together
The main loop for getting the process running and restarting
it again is
mloop
. The
adcnvrt
selection and actual conversion control. The
handles updating the PWM duty cycle register CCPR2L.
The routine
sendat
checks transmit ready status and loads
the transmit buffer when the status reports ready. You will
notice there is no error recovery routine. It is up to the user
to determine.
Here is what the program will do:
Once all peripherals have been initialized two sync bytes
"< >" are sent to the terminal. The A/D conversion results
are then sent and the LED brightness is adjusted to match
the RA0 trimpot setting. To simplify displaying A/D values,
only the highest nibble is used, and thirty is added to put it
into an ASCII range.
initsci
code handles the
code
sendat
routine handles port pin
dopwm
routine
相关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