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

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
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 AMICUS18-COMPANION-SHIELD