-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremote_car_avr_code.bas
More file actions
79 lines (65 loc) · 1.48 KB
/
remote_car_avr_code.bas
File metadata and controls
79 lines (65 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
$regfile = "m8def.dat"
$crystal = 1000000
Config Portd = Input
Config Portb = Output
Config Portc = Output
Dim A(4) As Byte , I As Byte , J As Byte , B As Byte , M As Byte
Dim D As Integer , F As Integer
'****************************************************************************************
Config Timer1 = Counter , Prescale = 256
Enable Int0
Config Int0 = Rising
Enable Interrupts
On Int0 Remote
Do
Loop
End
Remote:
Start Timer1
Do
Loop Until Pind.2 = 1
F = Timer1
Do
Loop Until Pind.2 = 0
Do
Loop Until Pind.2 = 1
Do
Loop Until Pind.2 = 0
For I = 1 To 4
For J = 7 To 0 Step -1
Timer1 = 0
Do
Loop Until Pind.2 = 1
B = Timer1 \ 4
A(i).j = B
Do
Loop Until Pind.2 = 0
Next
Next
Select Case A(3)
Case 40:
Portb = 0
Portc = 0
Case 8:
Portb = 0
Waitms 50
Portb = 4
Case 2:
Portc = 1
Waitms 500
Portc = 0
Case 226:
Portc = 2
Waitms 500
Portc = 0
Case 96:
Portb = 0
Waitms 50
Portb = 4
Case 34:
Portb = 0
Waitms 50
Portb = 2
End Select
Waitms 100
Return