1818281+1818282 Microchip Technology, 1818281+1818282 Datasheet - Page 44
![no-image](/images/manufacturer_photos/0/4/439/microchip_technology_sml.jpg)
1818281+1818282
Manufacturer Part Number
1818281+1818282
Description
EDF / AMICUS18 + SHIELD, BUNDLE
Manufacturer
Microchip Technology
Type
Development Boardr
Datasheet
1.AMICUS18-COMPANION-SHIELD.pdf
(49 pages)
Specifications of 1818281+1818282
Kit Contents
Board
Svhc
No SVHC (15-Dec-2010)
Kit Features
Nine 10-bit ADC Inputs, Two 10-bit PWM Outputs, Two Comparators
Mcu Supported Families
PIC18F25K20
Silicon Manufacturer
Microchip
Core Architecture
PIC
Core Sub-architecture
PIC18
Silicon Core Number
PIC18F
Silicon Family Name
PIC18FxxKxx
Amicus18 Companion Shield
There are calculations for the values of the resistor and capacitor used, but we won’t go into that here,
RC filter
but a search for
on the internet will produce a huge amount of information. Here’s two of them
that are valid at the time of writing:
http://www.cvs1.uklinux.net/cgi-bin/calculators/time_const.cgi
http://www.sengpielaudio.com/calculator-period.htm
Channel 1 PWM
In this discussion, we’ll be using the compiler’s WriteAnalog macros, which produce either an 8-bit (0
to 255) or 10-bit (0 to 1023) output. It’s important for further RC filter calculations to remember that
the 10-bit PWM macro’s operate at a frequency of 62.5KHz (62,500 Hertz), and the 8-bit PWM macros
operate at a frequency of 125KHz (125,000 Hertz), but only if the Amicus18 board is using it’s default
oscillator speed of 64MHz. If the crystal is replaced with another value type, these frequencies will
section 16
change. See
in the PIC18F25K20 microcontroller’s data sheet for further information concern-
ing the PWM peripherals.
From the paragraph above, we know that if we use the 10-bit PWM macros, we will be operating at a
frequency of 62.5KHz. This relates to a duty cycle of 0.06 milliseconds (ms), or 16 microseconds (us).
If we choose a value of 47 Ohms for our resistor so that we don’t loose too much current, we need a
capacitance value of 340.425nF (0.34uF). There is no common capacitor of that value so we’ll choose a
close value, for example 330nF (0.33uF).
The circuit for a suitable RC low pass filter is shown below:
47Ω
PWM
Voltage Out
Pulses In
R
C
330nF
The Amicus18’s microcontroller has two PWM peripherals; PWM1 from PortC pin RC2, and PWM2 from
PortC pin RC1. Each pin can produce a differing duty cycle (average voltage), but each share the same
frequency.
A demo layout for channel 1 of the PWM is shown below:
43
Crownhill AssociatesLimited 2009 - All Rights Reserved
Version 1.0
06-10-2009