1818281+1818282 Microchip Technology, 1818281+1818282 Datasheet - Page 45

no-image

1818281+1818282

Manufacturer Part Number
1818281+1818282
Description
EDF / AMICUS18 + SHIELD, BUNDLE
Manufacturer
Microchip Technology
Type
Development Boardr

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
The circuit for the PWM1 layout is shown below:
The PWM peripherals operate in the background, which means that once a PWM duty cycle is set, it
does not block any other instructions from occurring.
Type in the following code and program it into the Amicus18 board by clicking on the toolbar
and Program
Include
WriteAnalog1(512)
The LED will now be glowing, but not at full brightness. What’s happening is that channel 1 of the PWM
has been instructed to set the duty cycle to 50%, which is half the full range of 1023, which is 512. Try
different values within the braces of the WriteAnalog1 command and see what it does to the LED’s
brightness.
A more sophisticated program is shown below that will cycle the LED to full brightness then back to off
repeatedly:
' Amicus18 10-bit Hardware PWM (Pulse Width Modulation) Demo Program
' An LED attached to Bit-2 of Portc (RC2) will increase illumination, then dim
'
Crownhill AssociatesLimited 2009 - All Rights Reserved
Include
Dim wDutyCycle As Word
OpenAnalog1()
While 1 = 1
Wend
'
' Increase LED illumination
'
For wDutyCycle = 0 To 1023
Next
'
' Decrease LED illumination
'
For wDutyCycle = 1023 To 0 Step -1
Next
WriteAnalog1(wDutyCycle)
WriteAnalog1(wDutyCycle)
"Hpwm10.inc"
, or pressing F10:
"Hpwm10.inc"
Amicus18 Companion Shield
Version 1.0
' Load the 10-bit PWM macros into the program
' Create a variable to hold the Duty Cycle
' Enable and cofigure the CCP1 peripheral
' Create an infinite loop
' Cycle the full range of 10-bits. i.e. 0 to 1023
' PWM on CCP1 (Bit-2 of PortC)
PortC
Power
GND
GND
RC7
RC6
RC5
RC4
RC3
RC2
RC1
RC0
3V3
Vin
Rst
5V
' Cycle the full range of 10-bits in reverse
' PWM on CCP1 (Bit-2 of PortC)
' Do it forever
C
44
330nF
R
LED
47
Ω
06-10-2009
Compile

Related parts for 1818281+1818282