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

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 2 PWMs layout is shown below:
The capacitors normally associated with PWM output have been dispensed with because the operating
frequency of the PWM channels is so high (62.5KHz) that no noticeable flicker from the pulses will be
observed on the LEDs.
The code to produce the pulsing of the LEDs is shown below:
' Pulse both LEDs, one decreases while the other increases brightness
'
Crownhill AssociatesLimited 2009 - All Rights Reserved
Include
Dim wDutyCycle As Word
OpenAnalog1()
OpenAnalog2()
While 1 = 1
'
' Increase LED1 illumation, while decreasing LED2 illumination
'
Wend
For wDutyCycle = 0 To 1023
Next
DelayMS 5
'
' Decrease LED1 illumation, while increasing LED2 illumination
'
For wDutyCycle = 1023 To 0 Step -1
Next
WriteAnalog1(wDutyCycle)
WriteAnalog2(1023 - wDutyCycle)
DelayMS 5
WriteAnalog1(wDutyCycle)
WriteAnalog2(1023 - wDutyCycle)
DelayMS 5
"Hpwm10.inc"
Amicus18 Companion Shield
Version 1.0
' Load the 10-bit PWM macros into the program
' Holds the duty cycle of the PWM pulses
' Enable and cofigure the CCP1 peripheral
' Enable and cofigure the CCP2 peripheral
' Create an infinite loop
PortC
Power
GND
GND
RC7
RC6
RC5
RC4
RC3
RC2
RC1
RC0
3V3
Vin
Rst
5V
' Cycle the full range of 10-bits
' PWM on CCP1 (Bit-2 of PortC) (0 to 1023)
' PWM on CCP2 (Bit-1 of PortC) (1023 to 0)
' A small delay between duty cycle changes
' Close the loop
' Cycle the full 10-bit range (reversed)
' PWM on CCP1 (Bit-2 of PortC) (1023 to 0)
' PWM on CCP2 (Bit-1 of PortC) (0 to 1023)
' A small delay between duty cycle changes
' Close the loop
' Do it forever
48
LED
47
Ω
LED
47
Ω
06-10-2009

Related parts for AMICUS18-COMPANION-SHIELD