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

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 traffic light sequencer is shown below:
The sequence of traffic lights in the UK is shown below:
The program below shows the steps required to reproduce the sequence of lights shown above:
' Simulate a single traffic light using Red, Yellow, and Green LEDs
'
' Time that the Red and Amber lights will stay on
' Time that the Amber light will stay on
Type in the program above, remembering that you do not need to type in the comments. Click on the
toolbar
microcontroller. The three LEDs will then start sequencing.
Crownhill AssociatesLimited 2009 - All Rights Reserved
Symbol Red = RB0
Symbol Amber = RB1
Symbol Green = RB2
Symbol RedInterval = 4000
Symbol AmberRedInterval = RedInterval / 4
Symbol AmberInterval = RedInterval - AmberRedInterval
Symbol GreenInterval = 6000
While 1 = 1
Wend
High Red
DelayMS RedInterval
High Amber
DelayMS AmberRedInterval
Low Red
DelayMS AmberInterval
High Green
Low Amber
DelayMS GreenInterval
Low Green
High Amber
DelayMS AmberInterval
Low Amber
Compiler and Program
Amicus18 Companion Shield
Version 1.0
button or press F10 to compile the code and load it into the Amicus18’s
PortB
Power
' Red LED is attached to RB0
' Amber LED is attached to RB1
' Green LED is attached To RB2
' Time that the Red light will stay on
' Time that the Green light will stay on
' Create an infinite loop
' Illuminate the Red LED
' Wait for the appropriate length of time
' Illuminate the Amber LED
' Wait for the appropriate length of time
' Extinguish the Red LED
' Wait for the appropriate length of time
' Illuminate the Green LED
' Extinguish the Amber LED
' Wait for the appropriate length of time
' Extinguish the Green LED
' Illuminate the Amber LED
' Wait for the appropriate length of time
' Extinguish the Amber LED
' Do it forever
GND
RB7
RB6
RB5
RB4
RB3
RB2
RB1
RB0
Cathode
Anode
47
LED
Ω
20
47
LED
Ω
47
LED
Ω
06-10-2009

Related parts for AMICUS18-COMPANION-SHIELD