AMICUS18-COMPANION-SHIELD AMICUS, AMICUS18-COMPANION-SHIELD Datasheet - Page 45

Amicus18 Companion Shield

AMICUS18-COMPANION-SHIELD

Manufacturer Part Number
AMICUS18-COMPANION-SHIELD
Description
Amicus18 Companion Shield
Manufacturer
AMICUS

Specifications of AMICUS18-COMPANION-SHIELD

Silicon Manufacturer
Microchip
Core Architecture
PIC
Core Sub-architecture
PIC18
Features
USB Interface, In Circuit Serial Programming Interface
Kit Contents
Board
Silicon Family Name
PIC
Silicon Core Number
PIC18F25K20
Rohs Compliant
Yes
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With
PIC18F25K20 Microcontroller
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 AMICUS18-COMPANION-SHIELD