DESCRIPTION
This is a project using PIC microcontroller for controlling LED CHASING PATTERNS using a micro reset switch...
PROGRAM
#chip 16f628a
#config mclre=off
dir portb.0 output
dir portb.1 output
dir portb.2 output
dir portb.3 output
dir portb.4 output
dir portb.5 output
dir portb.6 output
dir portb.7 output
dir porta.3 in
dim temp as byte
temp=0
Do
if porta.3=1 then
temp=temp+1
wait 1 s
if temp>5 Then
temp=0
end if
end if
if temp=1 then
set portb.0 on
set portb.1 on
set portb.2 on
set portb.3 on
set portb.4 on
set portb.5 on
set portb.6 on
set portb.7 on
end if
if temp=2 Then
set portb.0 on
set portb.1 on
set portb.2 on
set portb.3 on
set portb.4 on
set portb.5 on
set portb.6 on
set portb.7 on
wait 1 s
set portb.0 off
set portb.1 off
set portb.2 off
set portb.3 off
set portb.4 off
set portb.5 off
set portb.6 off
set portb.7 off
wait 1 s
end if
if temp=3 Then
wait 100 ms
set portb.0 on
wait 100 ms
set portb.1 on
wait 100 ms
set portb.2 on
wait 100 ms
set portb.3 on
wait 100 ms
set portb.4 on
wait 100 ms
set portb.5 on
wait 100 ms
set portb.6 on
wait 100 ms
set portb.7 on
wait 100 ms
set portb.0 off
set portb.1 off
set portb.2 off
set portb.3 off
set portb.4 off
set portb.5 off
set portb.6 off
set portb.7 off
end if
if temp=4 Then
set portb.0 on
wait 100 ms
set portb.0 off
set portb.1 on
wait 100 ms
set portb.1 off
set portb.2 on
wait 100 ms
set portb.2 off
set portb.3 on
wait 100 ms
set portb.3 off
set portb.4 on
wait 100 ms
set portb.4 off
set portb.5 on
wait 100 ms
set portb.5 off
set portb.6 on
wait 100 ms
set portb.6 off
set portb.7 on
wait 100 ms
set portb.7 off
set portb.0 on
wait 50 ms
set portb.0 off
set portb.1 on
wait 50 ms
set portb.1 off
set portb.2 on
wait 50 ms
set portb.2 off
set portb.3 on
wait 50 ms
set portb.3 off
set portb.4 on
wait 50 ms
set portb.4 off
set portb.5 on
wait 50 ms
set portb.5 off
set portb.6 on
wait 50 ms
set portb.6 off
set portb.7 on
wait 50 ms
set portb.7 off
end if
if temp=5 Then
set portb.0 on
wait 100 ms
set portb.0 off
set portb.1 on
wait 100 ms
set portb.1 off
set portb.2 on
wait 100 ms
set portb.2 off
set portb.3 on
wait 100 ms
set portb.3 off
set portb.4 on
wait 100 ms
set portb.4 off
set portb.5 on
wait 100 ms
set portb.5 off
set portb.6 on
wait 100 ms
set portb.6 off
set portb.7 on
wait 100 ms
;step 2
set portb.0 on
wait 100 ms
set portb.0 off
set portb.1 on
wait 100 ms
set portb.1 off
set portb.2 on
wait 100 ms
set portb.2 off
set portb.3 on
wait 100 ms
set portb.3 off
set portb.4 on
wait 100 ms
set portb.4 off
set portb.5 on
wait 100 ms
set portb.5 off
set portb.6 on
wait 100 ms
;set portb.6 off
set portb.7 on
wait 100 ms
;step 3
set portb.0 on
wait 100 ms
set portb.0 off
set portb.1 on
wait 100 ms
set portb.1 off
set portb.2 on
wait 100 ms
set portb.2 off
set portb.3 on
wait 100 ms
set portb.3 off
set portb.4 on
wait 100 ms
set portb.4 off
set portb.5 on
wait 100 ms
;set portb.5 off
set portb.6 on
wait 100 ms
;set portb.6 off
set portb.7 on
wait 100 ms
set portb.0 on
wait 100 ms
set portb.0 off
set portb.1 on
wait 100 ms
set portb.1 off
set portb.2 on
wait 100 ms
set portb.2 off
set portb.3 on
wait 100 ms
set portb.3 off
set portb.4 on
wait 100 ms
;set portb.4 off
set portb.5 on
wait 100 ms
;set portb.5 off
set portb.6 on
wait 100 ms
;set portb.6 off
set portb.7 on
wait 100 ms
;step 5
set portb.0 on
wait 100 ms
set portb.0 off
set portb.1 on
wait 100 ms
set portb.1 off
set portb.2 on
wait 100 ms
set portb.2 off
set portb.3 on
wait 100 ms
;set portb.3 off
set portb.4 on
wait 100 ms
; set portb.4 off
set portb.5 on
wait 100 ms
;set portb.5 off
set portb.6 on
wait 100 ms
;set portb.6 off
set portb.7 on
wait 100 ms
;step 6
set portb.0 on
wait 100 ms
set portb.0 off
set portb.1 on
wait 100 ms
set portb.1 off
set portb.2 on
wait 100 ms
;set portb.2 off
set portb.3 on
wait 100 ms
;set portb.3 off
set portb.4 on
wait 100 ms
; set portb.4 off
set portb.5 on
wait 100 ms
;set portb.5 off
set portb.6 on
wait 100 ms
;set portb.6 off
set portb.7 on
wait 100 ms
;step 7
set portb.0 on
wait 100 ms
set portb.0 off
set portb.1 on
wait 100 ms
;set portb.1 off
set portb.2 on
wait 100 ms
;set portb.2 off
set portb.3 on
wait 100 ms
;set portb.3 off
set portb.4 on
wait 100 ms
;set portb.4 off
set portb.5 on
wait 100 ms
;set portb.5 off
set portb.6 on
wait 100 ms
;set portb.6 off
set portb.7 on
wait 100 ms
;step 8
set portb.0 on
wait 100 ms
;step 9
set portb.0 off
set portb.1 off
set portb.2 off
set portb.3 off
set portb.4 off
set portb.5 off
set portb.6 off
set portb.7 off
;fast..................................
set portb.0 on
wait 50 ms
set portb.0 off
set portb.1 on
wait 50 ms
set portb.1 off
set portb.2 on
wait 50 ms
set portb.2 off
set portb.3 on
wait 50 ms
set portb.3 off
set portb.4 on
wait 50 ms
set portb.4 off
set portb.5 on
wait 50 ms
set portb.5 off
set portb.6 on
wait 50 ms
set portb.6 off
set portb.7 on
wait 50 ms
;step 2
set portb.0 on
wait 50 ms
set portb.0 off
set portb.1 on
wait 50 ms
set portb.1 off
set portb.2 on
wait 50 ms
set portb.2 off
set portb.3 on
wait 50 ms
set portb.3 off
set portb.4 on
wait 50 ms
set portb.4 off
set portb.5 on
wait 50 ms
set portb.5 off
set portb.6 on
wait 50 ms
;set portb.6 off
set portb.7 on
wait 50 ms
;step 3
set portb.0 on
wait 50 ms
set portb.0 off
set portb.1 on
wait 50 ms
set portb.1 off
set portb.2 on
wait 50 ms
set portb.2 off
set portb.3 on
wait 50 ms
set portb.3 off
set portb.4 on
wait 50 ms
set portb.4 off
set portb.5 on
wait 50 ms
;set portb.5 off
set portb.6 on
wait 50 ms
;set portb.6 off
set portb.7 on
wait 50 ms
set portb.0 on
wait 50 ms
set portb.0 off
set portb.1 on
wait 50 ms
set portb.1 off
set portb.2 on
wait 50 ms
set portb.2 off
set portb.3 on
wait 50 ms
set portb.3 off
set portb.4 on
wait 50 ms
;set portb.4 off
set portb.5 on
wait 50 ms
;set portb.5 off
set portb.6 on
wait 50 ms
;set portb.6 off
set portb.7 on
wait 50 ms
;step 5
set portb.0 on
wait 50 ms
set portb.0 off
set portb.1 on
wait 50 ms
set portb.1 off
set portb.2 on
wait 50 ms
set portb.2 off
set portb.3 on
wait 50 ms
;set portb.3 off
set portb.4 on
wait 50 ms
; set portb.4 off
set portb.5 on
wait 50 ms
;set portb.5 off
set portb.6 on
wait 50 ms
;set portb.6 off
set portb.7 on
wait 50 ms
;step 6
set portb.0 on
wait 50 ms
set portb.0 off
set portb.1 on
wait 50 ms
set portb.1 off
set portb.2 on
wait 50 ms
;set portb.2 off
set portb.3 on
wait 50 ms
;set portb.3 off
set portb.4 on
wait 50 ms
; set portb.4 off
set portb.5 on
wait 50 ms
;set portb.5 off
set portb.6 on
wait 50 ms
;set portb.6 off
set portb.7 on
wait 50 ms
;step 7
set portb.0 on
wait 50 ms
set portb.0 off
set portb.1 on
wait 50 ms
;set portb.1 off
set portb.2 on
wait 50 ms
;set portb.2 off
set portb.3 on
wait 50 ms
;set portb.3 off
set portb.4 on
wait 50 ms
;set portb.4 off
set portb.5 on
wait 50 ms
;set portb.5 off
set portb.6 on
wait 50 ms
;set portb.6 off
set portb.7 on
wait 50 ms
;step 8
set portb.0 on
wait 50 ms
set portb.0 off
set portb.1 off
set portb.2 off
set portb.3 off
set portb.4 off
set portb.5 off
set portb.6 off
set portb.7 off
end if
loop
HEX FILE
:020000040000FA
:020000000528D1
:1000080009007E2383160313061086100611861135
:100018000612861206138613851583120313A00190
:10002800851D1E28A00A0130F40076232008053C0F
:10003800031CA0012003031D292806148614061595
:100048008615061686160617861702302002031D27
:1000580043280614861406158615061686160617EE
:1000680086170130F40076230610861006118611D3
:1000780006128612061386130130F4007623033025
:100088002002031D7B286430F200F3016823061464
:100098006430F200F301682386146430F200F3013F
:1000A800682306156430F200F3016823861564306E
:1000B800F200F301682306166430F200F3016823A6
:1000C80086166430F200F301682306176430F200E4
:1000D800F301682386176430F200F30168230610E1
:1000E800861006118611061286120613861304302E
:1000F8002002031DDF2806146430F200F301682390
:10010800061086146430F200F30168238610061581
:100118006430F200F3016823061186156430F2009A
:10012800F3016823861106166430F200F301682390
:10013800061286166430F200F30168238612061749
:100148006430F200F3016823061386176430F20066
:10015800F3016823861306143230F200F301682392
:10016800061086143230F200F30168238610061553
:100178003230F200F3016823061186153230F2009E
:10018800F3016823861106163230F200F301682362
:10019800061286163230F200F3016823861206171B
:1001A8003230F200F3016823061386173230F2006A
:1001B800F3016823861305302002031D652B0614FE
:1001C8006430F200F3016823061086146430F200EC
:1001D800F3016823861006156430F200F3016823E2
:1001E800061186156430F200F3016823861106169D
:1001F8006430F200F3016823061286166430F200B8
:10020800F3016823861206176430F200F3016823AD
:10021800061386176430F200F3016823061464306D
:10022800F200F3016823061086146430F200F3012B
:100238006823861006156430F200F301682306115E
:1002480086156430F200F3016823861106166430BF
:10025800F200F3016823061286166430F200F301F7
:100268006823861206176430F200F30168238617A4
:100278006430F200F301682306146430F200F301DD
:100288006823061086146430F200F3016823861090
:1002980006156430F200F3016823061186156430F0
:1002A800F200F3016823861106166430F200F301A8
:1002B8006823061286166430F200F30168230617D5
:1002C8006430F200F301682386176430F200F3010A
:1002D800682306146430F200F301682306108614BC
:1002E8006430F200F3016823861006156430F200CA
:1002F800F3016823061186156430F200F3016823C0
:10030800861106166430F200F301682386166430FD
:10031800F200F301682306176430F200F301682342
:1003280086176430F200F301682306146430F20083
:10033800F3016823061086146430F200F301682381
:10034800861006156430F200F3016823061186153D
:100358006430F200F301682306166430F200F301FA
:10036800682386166430F200F301682306176430A8
:10037800F200F301682386176430F200F301682362
:1003880006146430F200F301682306108614643002
:10039800F200F3016823861006156430F200F301B9
:1003A800682386156430F200F3016823061664306A
:1003B800F200F301682386166430F200F301682323
:1003C80006176430F200F301682386176430F200E0
:1003D800F301682306146430F200F3016823061061
:1003E80086146430F200F301682306156430F200C5
:1003F800F301682386156430F200F30168230616BA
:100408006430F200F301682386166430F200F301C9
:10041800682306176430F200F301682386176430F6
:10042800F200F301682306146430F200F301682334
:1004380006108610061186110612861206138613F8
:1004480006143230F200F3016823061086143230A5
:10045800F200F3016823861006153230F200F3012A
:100468006823061186153230F200F30168238611DD
:1004780006163230F200F30168230612861632306F
:10048800F200F3016823861206173230F200F301F6
:100498006823061386173230F200F3016823061426
:1004A8003230F200F3016823061086143230F2006D
:1004B800F3016823861006153230F200F301682331
:1004C800061186153230F200F301682386110616EC
:1004D8003230F200F3016823061286163230F20039
:1004E800F3016823861206173230F200F3016823FD
:1004F80086173230F200F301682306143230F20016
:10050800F3016823061086143230F200F3016823E1
:10051800861006153230F200F3016823061186159D
:100528003230F200F3016823861106163230F200E9
:10053800F3016823061286163230F200F3016823AD
:1005480006173230F200F301682386173230F200C2
:10055800F301682306143230F200F3016823061011
:1005680086143230F200F301682386100615323003
:10057800F200F3016823061186153230F200F30108
:100588006823861106163230F200F30168238616B6
:100598003230F200F301682306173230F200F3011B
:1005A800682386173230F200F301682306143230CC
:1005B800F200F3016823061086143230F200F301CA
:1005C8006823861006153230F200F30168230611FD
:1005D80086153230F200F301682306163230F20035
:1005E800F301682386163230F200F30168230617F8
:1005F8003230F200F301682386173230F200F3013B
:10060800682306143230F200F301682306108614BA
:100618003230F200F3016823861006153230F200FA
:10062800F301682386153230F200F30168230616B9
:100638003230F200F301682386163230F200F301FB
:10064800682306173230F200F30168238617323028
:10065800F200F301682306143230F200F301682334
:10066800061086143230F200F30168230615323082
:10067800F200F301682386153230F200F301682393
:1006880006163230F200F301682386163230F20083
:10069800F301682306173230F200F3016823861746
:1006A8003230F200F301682306143230F200F3010D
:1006B8006823061086100611861106128612061384
:1006C800861314286300662BF30A8E30F10001307C
:1006D800F000F00B6D2BF10B6B2BF20B692BF30B6E
:1006E800692B0800E830F2000330F3006823F40BAC
:0E06F800762B080007309F0085018601080060
:02400E00583F19
:00000001FF
0 Comments