47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
' ########### start ###########
|
|
' pic:PIC16C84
|
|
' ########### end ###########
|
|
'
|
|
' ******************************************************************
|
|
' Test for a IRQ Routine with a PIC16C84
|
|
' 2014-08-18 (c) Paolo Iocco
|
|
' ******************************************************************
|
|
'
|
|
' Circuit diagram
|
|
' ---------------
|
|
' +--\/--+
|
|
' nc-----|1° 18|-------->LED
|
|
' nc-----|2 17|-----nc
|
|
' nc-----|3 16|<--------H
|
|
' +5V--|50K|-->|4 15|<--------H = 4 MHz chrystal+ capacitors
|
|
' GND-------->|5 14|<--------+5V
|
|
' nc-----|6 13|-----nc
|
|
' nc-----|7 12|-----nc
|
|
' nc-----|8 11|-----nc
|
|
' nc-----|9 10|-----nc
|
|
' +------+
|
|
'
|
|
' ******************************************************************
|
|
|
|
#Chip 16C84, 4
|
|
#Config OSC = XT, WDT = OFF, PWRTE = ON, CP = OFF
|
|
|
|
dir PORTB out
|
|
dim direzione as byte
|
|
|
|
Startup:
|
|
direzione = 1
|
|
PORTB = 1
|
|
|
|
Loop:
|
|
do
|
|
if direzione=1 then
|
|
rotate PORTB left
|
|
if PORTB >= 64 then direzione = 0
|
|
else
|
|
rotate PORTB right
|
|
if PORTB <= 1 then direzione = 1
|
|
end if
|
|
wait 250 ms
|
|
loop
|