6. ر : داﻥ ل ﻥ و و ز
س ﺏ زر :اﺱ د
:7 ال ح
ن 2 0 ﺕ 99 رو د دوم ا اد زدن 0 ﺕ 99 و اول ا اد زوج زدن ا
داد ﺵ د
:7 ﺕ
$regfile = "m16def.dat"
$crystal = 8000000
Config Porta = Output ل .7 ل ﺵ ا اد زوج و ا .5 .ا را .7 ه 5. و ا ا ا
ف
Config Portb = Output .ه 0 ﺕ 99 را ل ﺵ ا اد د
Config Portc = Input ط دوم )ا زوج ﺵ ر ه ﺵ د را ه ر
Dim A As Byte , I As Byte , ، 5( را دﺵ ر ﺵ 7 ا ﺵ
J As Byte , B As Byte ار ﺵ ط دوم ه وز ار د ﺵ رش ادا ا
Home: و دو ر از ا ا ﺵ وع ﺵ رش ط نﺵ ط ش
If Pinc.0 = 1 Then Goto Zoj .
If Pinc.1 = 1 Then Goto Fard
نر ده ، م ﺡ د را اه ا اد زوج
Fard: ه ار دو
For I = 0 To 9
A = Lookup(i , Seg)
Porta = A
For J = 1 To 9 Step 2
B = Lookup(j , Seg)
Portb = B
Waitms 500
Next I
Next J
Goto Home
Zoj:
For I = 0 To 9
A = Lookup(i , Seg)
Porta = A
For J = 0 To 9 Step 2
B = Lookup(j , Seg)
Portb = B
Waitms 500
Next I
Next J
Goto Home
Seg:
Data &H3F , &H06 , &H5B , &H4F ,
&H66 , &H6D , &H7D , &H07 ,
&H7F , &H6F
6
7. ر : داﻥ ل ﻥ و و ز
س ﺏ زر :اﺱ د
SW2
22
23
24
25
26
27
28
29
14
15
16
17
18
19
20
21
32
30
U2
PC2/TCK
PC3/TMS
PD4/OC1B
PC4/TDO
AREF
PD0/RXD
PD1/TXD
AVCC
PC1/SDA
PD5/OC1A
PC0/SCL
PC5/TDI
PC6/TOSC1
PC7/TOSC2
PD2/INT0
PD3/INT1
PD6/ICP1
PD7/OC2
ATMEGA16
SW-DPDT-MOM
PB2/AIN0/INT2
PB3/AIN1/OC0
PB0/T0/XCK
PA0/ADC0
PA1/ADC1
PA2/ADC2
PA3/ADC3
PA4/ADC4
PA5/ADC5
PA6/ADC6
PA7/ADC7
PB6/MISO
PB5/MOSI
PB7/SCK
PB4/SS
PB1/T1
RESET
XTAL1
XTAL2
9
12
13
40
39
38
37
36
35
34
33
1
2
3
4
5
6
7
8
: ز ال ا
.رد د د را از ادا دوم زد ﺵ ا اد زوج اول در ﺹ رﺕ ا
1 $regfile = "m16def.dat"
2 $crystal = 8000000
3 Config Porta = Output
4 Config Portb = Output
5 Config Portc = Input
6 Dim A As Byte , I As Byte , J As Byte , B As Byte , X As Byte , Y As Byte , D As Byte , S As Byte
7 Home:
8 If Pinc.5 = 1 Then
9 X=0 ، ﺵ رش ادا ده (ﺵ ط )د زوج د اه ه ر از ادا ن
10 Y = 0 ( 46ط 82 و 92 و54 و ). ار ده ن و ن ﺵ رش را در ه م ذ ه را ﺕ
11 Goto Zoj (39ط 91و22و63و ). ه ﺵ وع از ا ﺡ ه را ه
12 End If د د ﺕ ﺕ ا زوج ﺵ ر ﺵ واﺡ ا ار ن م در ه م
13 If Pinc.7 = 1 Then (46 ط 92 و ) د ا را ذ د زوج دﺵ ر ﺵ را و
14 D=0
15 S=1
16 Goto Fard
17 End If
18 Fard:
19 For I = D To 9
20 A = Lookup(i , Seg)
21 Porta = A
22 For J = S To 9 Step 2
23 B = Lookup(j , Seg)
24 Portb = B
25 S=1
26 Waitms 500
27 If Pinc.5 = 1 Then
28 X=I
7
8. ر : داﻥ ل ﻥ و و ز
س ﺏ زر :اﺱ د
29 Y = J + 1
30 Goto Zoj
31 End If
32 Next J
33 Next I
34 Goto Home
35 Zoj:
36 For I = X To 9
37 A = Lookup(i , Seg)
38 Porta = A
39 For J = Y To 8 Step 2
40 B = Lookup(j , Seg)
41 Portb = B
42 Y = 0
43 Waitms 500
44 If Pinc.7 = 1 Then
45 D = I
46 S = J + 1
47 Goto Fard
48 End If
49 Next J
50 Next I
51 Goto Home
52 End Program
53 Seg:
54 Data &H3F , &H06 , &H5B , &H4F , &H66 , &H6D , &H7D , &H07 , &H7F , &H6F
د ش ه اول زد ﺵ ا ا ﺵ را در ه ان ﺕ م
ط ه ا م ﺵ د .و ا لا ا ه . دو ر ﺵ ط را
.د ﺵ ر( ا م ﺵ د )زوج ل ر ن ل د ن
$regfile = "m16def.dat"
$crystal = 8000000 Next W
Config Portd = Output Goto Dd
Config Porta = Output
Config Portb = Output Led2:
Config Portc = Input Portd = &HFF
Dim A As Byte , I As Byte , J As Byte Waitms 250
Dim B As Byte , X As Byte , Y As Byte Bb:
Dim D As Byte , S As Byte R=7
Dim W As Integer , R As Integer For W = 0 To 3
Dd: Reset Portd.w
If Pinc.3 = 1 Then Goto Led Reset Portd.r
If Pinc.4 = 1 Then Goto Count Waitms 250
Goto Dd Set Portd.w
Led: Set Portd.r
Porta = &H00 R=R-1
Portb = &H00 Next W
If Pinc.0 = 1 Then Goto Led1 zR = 2
If Pinc.1 = 1 Then Goto Led2 For W = 5 To 7
If Pinc.2 = 1 Then Goto Led3 Reset Portd.w
Reset Portd.r
8 Waitms 250
Set Portd.w
Set Portd.r