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

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
In order to detect and debounce a switch that is pulled down to ground through a resistor, the following
code can be used. It’s essentially the same program as the pulled up version, but references to 0 now
reference 1, and vice-versa:
' Debounce a switch input (Pulled-Down)
' The LED will toggle On and Off whenever the switch is pressed
'
Main:
Crownhill AssociatesLimited 2009 - All Rights Reserved
Dim Switch_Count As Byte
Symbol DetectsInARow = 5
Symbol Switch_Pin = PORTB.4
Symbol LED = PORTB.0
Low LED
Input Switch_Pin
While 1 = 1
Wend
While Switch_Pin <> 0 : Wend
Switch_Count = 5
Repeat
Until Switch_Count >= DetectsInARow
Toggle LED
If Switch_Pin == 1 Then
Else
EndIf
DelayMS 1
Inc Switch_Count
Switch_Count = 0
Amicus18 Companion Shield
Version 1.0
' Monitor switch input for 5 highs in a row to debounce
' Holds the switch counter amounts
' The amount of counts to perform
' Pin where the switch is connected
' Pin where the LED is connected
' Extinguish the LED
' Make the switch pin a input
' Create an infinite loop
' Wait for switch to be released (Pulled Down)
' Pressed state detected ?
' Yes. So increment the counter
' Otherwise...
' Reset the counter
' Wait for 1ms
' Toggle the LED On/Off
' Do it forever
' Exit when 5 iterations have been performed
29
06-10-2009

Related parts for 1818281+1818282