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

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
Type in the following code and program it into the Amicus18 board by clicking on the toolbar
and Program
Include
WriteAnalog2(512)
The LED will now be glowing, but not at full brightness. What’s happening is that channel 2 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 WriteAnalog2 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-1 of Portc (RC1) will increase illumination, then dim
'
Crownhill AssociatesLimited 2009 - All Rights Reserved
Include
Dim wDutyCycle As Word
OpenAnalog2()
While 1 = 1
Wend
'
' Increase LED illumination
'
For wDutyCycle = 0 To 1023
Next
'
' Decrease LED illumination
'
For wDutyCycle = 1023 To 0 Step -1
Next
WriteAnalog2(wDutyCycle)
WriteAnalog2(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 CCP2 peripheral
' Create an infinite loop
' Cycle the full range of 10-bits. i.e. 0 to 1023
' PWM on CCP2 (Bit-1 of PortC)
' Cycle the full range of 10-bits in reverse
' PWM on CCP2 (Bit-1 of PortC)
' Do it forever
46
06-10-2009
Compile

Related parts for 1818281+1818282