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

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
In order to change the level of darkness that the LDR will react too is simply a matter of changing the
value within the line “If LDR_Value > 400 Then”. A larger value will illuminate the LED at darker
levels. The best way to calibrate the program is to examine the values produced by your particular LDR
in light an dark situations. The program below will display the LDR values on the serial terminal:
' Display the value produced from an LDR
'
'
' Open the ADC:
'
'
'
'
'
'
Once the code is compiled and loaded into the Amicus18, open the serial teminal:
As can be seen from the above screenshot, ambient light levels give an approximate value of 315, so
anything above this value will indicate a light level decrease. However, we don’t want to make it too
sensitive, so a value of 400 is ideal.
Crownhill AssociatesLimited 2009 - All Rights Reserved
Dim LDR_Value As Word
Include
OpenADC(ADC_FOSC_RC & ADC_RIGHT_JUST & ADC_2_TAD, ADC_REF_VDD_VSS, ADC_1ANA)
While 1 = 1
Wend
LDR_Value = ReadADC(0)
HRSOut Dec LDR_Value, 13
DelayMS 500
"ADC.inc"
Fosc Set For internal RC Oscillator
Right justified for 10-bit operation
Tad value of 2
Vref+ at Vcc : Vref- at Gnd
Make AN0 an analogue input
Light Level Dropped Here
Light Level Increased Here
Amicus18 Companion Shield
Version 1.0
' Load the ADC macros into the program
' Create an infinite loop
' Read the ADC value from AN0
' Display the value on the serial terminal
' Wait half a second
' Do it forever
' Holds the 10-bit ADC value from the LDR
34
06-10-2009

Related parts for AMICUS18-COMPANION-SHIELD