47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
' ########### start ###########
|
|
' pic:PIC16C84
|
|
' ########### end ###########
|
|
'
|
|
' ******************************************************************
|
|
' Knight Rider with a PIC16C84
|
|
' 2014-08-18 (c) Paolo Iocco#
|
|
' ******************************************************************
|
|
'
|
|
' Circuit diagram
|
|
' ---------------
|
|
' +--\/--+
|
|
' nc-----|1° 18|-----nc
|
|
' nc-----|2 17|-----nc
|
|
' nc-----|3 16|<--------H
|
|
' +5V--|50K|-->|4 15|<--------H = 4 MHz chrystal+ capacitors
|
|
' GND-------->|5 14|<--------+5V
|
|
' LED<--------|6 13|-------->LED
|
|
' LED<--------|7 12|-------->LED
|
|
' LED<--------|8 11|-------->LED
|
|
' LED<--------|9 10|-------->LED
|
|
' +------+
|
|
'
|
|
' ******************************************************************
|
|
|
|
#Chip 16C84, 4
|
|
#Config OSC = XT, WDT = OFF, PWRTE = ON, CP = OFF
|
|
|
|
#define led PORTB.0
|
|
dir led out
|
|
|
|
|
|
|
|
'Main routine
|
|
Loop:
|
|
'Turn one LED on, the other off
|
|
SET led ON
|
|
Wait 500 ms
|
|
|
|
'Now toggle the LEDs
|
|
SET led OFF
|
|
Wait 500 ms
|
|
|
|
'Jump back to the start of the program
|
|
goto Loop
|
|
|