line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VIC::PIC::P18F442; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.31'; |
5
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
6
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
extends 'VIC::PIC::P18F242'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# role CodeGen |
10
|
|
|
|
|
|
|
has type => (is => 'ro', default => 'p18f442'); |
11
|
|
|
|
|
|
|
has include => (is => 'ro', default => 'p18f442.inc'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has pin_counts => (is => 'ro', default => sub { { |
14
|
|
|
|
|
|
|
pdip => 40, ## PDIP or DIP ? |
15
|
|
|
|
|
|
|
plcc => 44, |
16
|
|
|
|
|
|
|
tqfp => 44, |
17
|
|
|
|
|
|
|
total => 40, |
18
|
|
|
|
|
|
|
io => 34, |
19
|
|
|
|
|
|
|
}}); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has registers => (is => 'ro', default => sub { |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
TOSU => [0xFFF], |
24
|
|
|
|
|
|
|
TOSH => [0xFFE], |
25
|
|
|
|
|
|
|
TOSL => [0xFFD], |
26
|
|
|
|
|
|
|
STKPTR => [0xFFC], |
27
|
|
|
|
|
|
|
PCLATU => [0xFFB], |
28
|
|
|
|
|
|
|
PCLATH => [0xFFA], |
29
|
|
|
|
|
|
|
PCL => [0xFF9], |
30
|
|
|
|
|
|
|
TBLPTRU => [0xFF8], |
31
|
|
|
|
|
|
|
TBLPTRH => [0xFF7], |
32
|
|
|
|
|
|
|
TBLPTRL => [0xFF6], |
33
|
|
|
|
|
|
|
TABLAT => [0xFF5], |
34
|
|
|
|
|
|
|
PRODH => [0xFF4], |
35
|
|
|
|
|
|
|
PRODL => [0xFF3], |
36
|
|
|
|
|
|
|
INTCON => [0xFF2], |
37
|
|
|
|
|
|
|
INTCON2 => [0xFF1], |
38
|
|
|
|
|
|
|
INTCON3 => [0xFF0], |
39
|
|
|
|
|
|
|
INDF0 => [0xFEF], |
40
|
|
|
|
|
|
|
POSTINC0 => [0xFEE], |
41
|
|
|
|
|
|
|
POSTDEC0 => [0xFED], |
42
|
|
|
|
|
|
|
PREINC0 => [0xFEC], |
43
|
|
|
|
|
|
|
PLUSW0 => [0xFEB], |
44
|
|
|
|
|
|
|
FSR0H => [0xFEA], |
45
|
|
|
|
|
|
|
FSR0L => [0xFE9], |
46
|
|
|
|
|
|
|
WREG => [0xFE8], |
47
|
|
|
|
|
|
|
INDF1 => [0xFE7], |
48
|
|
|
|
|
|
|
POSTINC1 => [0xFE6], |
49
|
|
|
|
|
|
|
POSTDEC1 => [0xFE5], |
50
|
|
|
|
|
|
|
PREINC1 => [0xFE4], |
51
|
|
|
|
|
|
|
PLUSW1 => [0xFE3], |
52
|
|
|
|
|
|
|
FSR1H => [0xFE2], |
53
|
|
|
|
|
|
|
FSR1L => [0xFE1], |
54
|
|
|
|
|
|
|
BSR => [0xFE0], |
55
|
|
|
|
|
|
|
INDF2 => [0xFDF], |
56
|
|
|
|
|
|
|
POSTINC2 => [0xFDE], |
57
|
|
|
|
|
|
|
POSTDEC2 => [0xFDD], |
58
|
|
|
|
|
|
|
PREINC2 => [0xFDC], |
59
|
|
|
|
|
|
|
PLUSW2 => [0xFDB], |
60
|
|
|
|
|
|
|
FSR2H => [0xFDA], |
61
|
|
|
|
|
|
|
FSR2L => [0xFD9], |
62
|
|
|
|
|
|
|
STATUS => [0xFD8], |
63
|
|
|
|
|
|
|
TMR0H => [0xFD7], |
64
|
|
|
|
|
|
|
TMR0L => [0xFD6], |
65
|
|
|
|
|
|
|
T0CON => [0xFD5], |
66
|
|
|
|
|
|
|
OSCCON => [0xFD3], |
67
|
|
|
|
|
|
|
LVDCON => [0xFD2], |
68
|
|
|
|
|
|
|
WDTCON => [0xFD1], |
69
|
|
|
|
|
|
|
RCON => [0xFD0], |
70
|
|
|
|
|
|
|
TMR1H => [0xFCF], |
71
|
|
|
|
|
|
|
TMR1L => [0xFCE], |
72
|
|
|
|
|
|
|
T1CON => [0xFCD], |
73
|
|
|
|
|
|
|
TMR2 => [0xFCC], |
74
|
|
|
|
|
|
|
PR2 => [0xFCB], |
75
|
|
|
|
|
|
|
T2CON => [0xFCA], |
76
|
|
|
|
|
|
|
SSPBUF => [0xFC9], |
77
|
|
|
|
|
|
|
SSPADD => [0xFC8], |
78
|
|
|
|
|
|
|
SSPSTAT => [0xFC7], |
79
|
|
|
|
|
|
|
SSPCON1 => [0xFC6], |
80
|
|
|
|
|
|
|
SSPCON2 => [0xFC5], |
81
|
|
|
|
|
|
|
ADRESH => [0xFC4], |
82
|
|
|
|
|
|
|
ADRESL => [0xFC3], |
83
|
|
|
|
|
|
|
ADCON0 => [0xFC2], |
84
|
|
|
|
|
|
|
ADCON1 => [0xFC1], |
85
|
|
|
|
|
|
|
CCPR1H => [0xFBF], |
86
|
|
|
|
|
|
|
CCPR1L => [0xFBE], |
87
|
|
|
|
|
|
|
CCP1CON => [0xFBD], |
88
|
|
|
|
|
|
|
CCPR2H => [0xFBC], |
89
|
|
|
|
|
|
|
CCPR2L => [0xFBB], |
90
|
|
|
|
|
|
|
CCP2CON => [0xFBA], |
91
|
|
|
|
|
|
|
TMR3H => [0xFB3], |
92
|
|
|
|
|
|
|
TMR3L => [0xFB2], |
93
|
|
|
|
|
|
|
T3CON => [0xFB1], |
94
|
|
|
|
|
|
|
SPBRG => [0xFAF], |
95
|
|
|
|
|
|
|
RCREG => [0xFAE], |
96
|
|
|
|
|
|
|
TXREG => [0xFAD], |
97
|
|
|
|
|
|
|
TXSTA => [0xFAC], |
98
|
|
|
|
|
|
|
RCSTA => [0xFAB], |
99
|
|
|
|
|
|
|
EEADR => [0xFA9], |
100
|
|
|
|
|
|
|
EEDATA => [0xFA8], |
101
|
|
|
|
|
|
|
EECON2 => [0xFA7], |
102
|
|
|
|
|
|
|
EECON1 => [0xFA6], |
103
|
|
|
|
|
|
|
IPR2 => [0xFA2], |
104
|
|
|
|
|
|
|
PIR2 => [0xFA1], |
105
|
|
|
|
|
|
|
PIE2 => [0xFA0], |
106
|
|
|
|
|
|
|
IPR1 => [0xF9F], |
107
|
|
|
|
|
|
|
PIR1 => [0xF9E], |
108
|
|
|
|
|
|
|
PIE1 => [0xF9D], |
109
|
|
|
|
|
|
|
TRISE => [0xF96], |
110
|
|
|
|
|
|
|
TRISD => [0xF95], |
111
|
|
|
|
|
|
|
TRISC => [0xF94], |
112
|
|
|
|
|
|
|
TRISB => [0xF93], |
113
|
|
|
|
|
|
|
TRISA => [0xF92], |
114
|
|
|
|
|
|
|
LATE => [0xF8D], |
115
|
|
|
|
|
|
|
LATD => [0xF8C], |
116
|
|
|
|
|
|
|
LATC => [0xF8B], |
117
|
|
|
|
|
|
|
LATB => [0xF8A], |
118
|
|
|
|
|
|
|
LATA => [0xF89], |
119
|
|
|
|
|
|
|
PORTE => [0xF84], |
120
|
|
|
|
|
|
|
PORTD => [0xF83], |
121
|
|
|
|
|
|
|
PORTC => [0xF82], |
122
|
|
|
|
|
|
|
PORTB => [0xF81], |
123
|
|
|
|
|
|
|
PORTA => [0xF80], |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
}); |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
has pins => (is => 'ro', default => sub { |
128
|
|
|
|
|
|
|
my $h = { |
129
|
|
|
|
|
|
|
1 => [qw(MCLR Vpp)], |
130
|
|
|
|
|
|
|
13 => [qw(OSC1 CLKI)], |
131
|
|
|
|
|
|
|
14 => [qw(OSC2 CLKO RA6)], |
132
|
|
|
|
|
|
|
2 => [qw(RA0 AN0)], |
133
|
|
|
|
|
|
|
3 => [qw(RA1 AN1)], |
134
|
|
|
|
|
|
|
4 => [qw(RA2 AN2 Vref-)], |
135
|
|
|
|
|
|
|
5 => [qw(RA3 AN3 Vref+)], |
136
|
|
|
|
|
|
|
6 => [qw(RA4 T0CKI)], |
137
|
|
|
|
|
|
|
7 => [qw(RA5 AN4 SS LVDIN)], |
138
|
|
|
|
|
|
|
33 => [qw(RB0 INT0)], |
139
|
|
|
|
|
|
|
34 => [qw(RB1 INT1)], |
140
|
|
|
|
|
|
|
35 => [qw(RB2 INT2)], |
141
|
|
|
|
|
|
|
36 => [qw(RB3 CCP2)], |
142
|
|
|
|
|
|
|
37 => [qw(RB4)], |
143
|
|
|
|
|
|
|
38 => [qw(RB5 PGM)], |
144
|
|
|
|
|
|
|
39 => [qw(RB6 PGC)], |
145
|
|
|
|
|
|
|
40 => [qw(RB7 PGD)], |
146
|
|
|
|
|
|
|
15 => [qw(RC0 T1OSO T1CKI)], |
147
|
|
|
|
|
|
|
16 => [qw(RC1 T1OSI CCP2)], |
148
|
|
|
|
|
|
|
17 => [qw(RC2 CCP1)], |
149
|
|
|
|
|
|
|
18 => [qw(RC3 SCK SCL)], |
150
|
|
|
|
|
|
|
23 => [qw(RC4 SDI SDA)], |
151
|
|
|
|
|
|
|
24 => [qw(RC5 SDO)], |
152
|
|
|
|
|
|
|
25 => [qw(RC6 TX CK)], |
153
|
|
|
|
|
|
|
26 => [qw(RC7 RX DT)], |
154
|
|
|
|
|
|
|
19 => [qw(RD0 PSP0)], |
155
|
|
|
|
|
|
|
20 => [qw(RD1 PSP1)], |
156
|
|
|
|
|
|
|
21 => [qw(RD2 PSP2)], |
157
|
|
|
|
|
|
|
22 => [qw(RD3 PSP3)], |
158
|
|
|
|
|
|
|
27 => [qw(RD4 PSP4)], |
159
|
|
|
|
|
|
|
28 => [qw(RD5 PSP5)], |
160
|
|
|
|
|
|
|
29 => [qw(RD6 PSP6)], |
161
|
|
|
|
|
|
|
30 => [qw(RD7 PSP7)], |
162
|
|
|
|
|
|
|
8 => [qw(RE0 RD AN5)], |
163
|
|
|
|
|
|
|
9 => [qw(RE1 WR AN6)], |
164
|
|
|
|
|
|
|
10 => [qw(RE2 CS AN7)], |
165
|
|
|
|
|
|
|
11 => [qw(Vdd)], |
166
|
|
|
|
|
|
|
12 => [qw(Vss)], |
167
|
|
|
|
|
|
|
31 => [qw(Vss)], |
168
|
|
|
|
|
|
|
32 => [qw(Vdd)], |
169
|
|
|
|
|
|
|
}; |
170
|
|
|
|
|
|
|
foreach my $k (keys %$h) { |
171
|
|
|
|
|
|
|
my $v = $h->{$k}; |
172
|
|
|
|
|
|
|
foreach (@$v) { |
173
|
|
|
|
|
|
|
$h->{$_} = $k; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
return $h; |
177
|
|
|
|
|
|
|
}); |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
has io_ports => (is => 'ro', default => sub { |
180
|
|
|
|
|
|
|
{ |
181
|
|
|
|
|
|
|
#port => tristate, |
182
|
|
|
|
|
|
|
PORTA => 'TRISA', |
183
|
|
|
|
|
|
|
PORTB => 'TRISB', |
184
|
|
|
|
|
|
|
PORTC => 'TRISC', |
185
|
|
|
|
|
|
|
PORTD => 'TRISD', |
186
|
|
|
|
|
|
|
PORTE => 'TRISE', |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
}); |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
has input_pins => (is => 'ro', default => sub { |
191
|
|
|
|
|
|
|
{ |
192
|
|
|
|
|
|
|
#I/O => [port, tristate, bit] |
193
|
|
|
|
|
|
|
RA0 => ['PORTA', 'TRISA', 0], |
194
|
|
|
|
|
|
|
RA1 => ['PORTA', 'TRISA', 1], |
195
|
|
|
|
|
|
|
RA2 => ['PORTA', 'TRISA', 2], |
196
|
|
|
|
|
|
|
RA3 => ['PORTA', 'TRISA', 3], |
197
|
|
|
|
|
|
|
RA4 => ['PORTA', 'TRISA', 4], |
198
|
|
|
|
|
|
|
RA5 => ['PORTA', 'TRISA', 5], |
199
|
|
|
|
|
|
|
RB0 => ['PORTB', 'TRISB', 0], |
200
|
|
|
|
|
|
|
RB1 => ['PORTB', 'TRISB', 1], |
201
|
|
|
|
|
|
|
RB2 => ['PORTB', 'TRISB', 2], |
202
|
|
|
|
|
|
|
RB3 => ['PORTB', 'TRISB', 3], |
203
|
|
|
|
|
|
|
RB4 => ['PORTB', 'TRISB', 4], |
204
|
|
|
|
|
|
|
RB5 => ['PORTB', 'TRISB', 5], |
205
|
|
|
|
|
|
|
RB6 => ['PORTB', 'TRISB', 6], |
206
|
|
|
|
|
|
|
RB7 => ['PORTB', 'TRISB', 7], |
207
|
|
|
|
|
|
|
RC0 => ['PORTC', 'TRISC', 0], |
208
|
|
|
|
|
|
|
RC1 => ['PORTC', 'TRISC', 1], |
209
|
|
|
|
|
|
|
RC2 => ['PORTC', 'TRISC', 2], |
210
|
|
|
|
|
|
|
RC3 => ['PORTC', 'TRISC', 3], |
211
|
|
|
|
|
|
|
RC4 => ['PORTC', 'TRISC', 4], |
212
|
|
|
|
|
|
|
RC5 => ['PORTC', 'TRISC', 5], |
213
|
|
|
|
|
|
|
RC6 => ['PORTC', 'TRISC', 6], |
214
|
|
|
|
|
|
|
RC7 => ['PORTC', 'TRISC', 7], |
215
|
|
|
|
|
|
|
RD0 => ['PORTD', 'TRISD', 0], |
216
|
|
|
|
|
|
|
RD1 => ['PORTD', 'TRISD', 1], |
217
|
|
|
|
|
|
|
RD2 => ['PORTD', 'TRISD', 2], |
218
|
|
|
|
|
|
|
RD3 => ['PORTD', 'TRISD', 3], |
219
|
|
|
|
|
|
|
RD4 => ['PORTD', 'TRISD', 4], |
220
|
|
|
|
|
|
|
RD5 => ['PORTD', 'TRISD', 5], |
221
|
|
|
|
|
|
|
RD6 => ['PORTD', 'TRISD', 6], |
222
|
|
|
|
|
|
|
RD7 => ['PORTD', 'TRISD', 7], |
223
|
|
|
|
|
|
|
RE0 => ['PORTE', 'TRISE', 0], |
224
|
|
|
|
|
|
|
RE1 => ['PORTE', 'TRISE', 1], |
225
|
|
|
|
|
|
|
RE2 => ['PORTE', 'TRISE', 2], |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
}); |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
has output_pins => (is => 'ro', default => sub { |
230
|
|
|
|
|
|
|
{ |
231
|
|
|
|
|
|
|
#I/O => [port, tristate, bit] |
232
|
|
|
|
|
|
|
RA0 => ['PORTA', 'TRISA', 0], |
233
|
|
|
|
|
|
|
RA1 => ['PORTA', 'TRISA', 1], |
234
|
|
|
|
|
|
|
RA2 => ['PORTA', 'TRISA', 2], |
235
|
|
|
|
|
|
|
RA3 => ['PORTA', 'TRISA', 3], |
236
|
|
|
|
|
|
|
RA4 => ['PORTA', 'TRISA', 4], |
237
|
|
|
|
|
|
|
RA5 => ['PORTA', 'TRISA', 5], |
238
|
|
|
|
|
|
|
RB0 => ['PORTB', 'TRISB', 0], |
239
|
|
|
|
|
|
|
RB1 => ['PORTB', 'TRISB', 1], |
240
|
|
|
|
|
|
|
RB2 => ['PORTB', 'TRISB', 2], |
241
|
|
|
|
|
|
|
RB3 => ['PORTB', 'TRISB', 3], |
242
|
|
|
|
|
|
|
RB4 => ['PORTB', 'TRISB', 4], |
243
|
|
|
|
|
|
|
RB5 => ['PORTB', 'TRISB', 5], |
244
|
|
|
|
|
|
|
RB6 => ['PORTB', 'TRISB', 6], |
245
|
|
|
|
|
|
|
RB7 => ['PORTB', 'TRISB', 7], |
246
|
|
|
|
|
|
|
RC0 => ['PORTC', 'TRISC', 0], |
247
|
|
|
|
|
|
|
RC1 => ['PORTC', 'TRISC', 1], |
248
|
|
|
|
|
|
|
RC2 => ['PORTC', 'TRISC', 2], |
249
|
|
|
|
|
|
|
RC3 => ['PORTC', 'TRISC', 3], |
250
|
|
|
|
|
|
|
RC4 => ['PORTC', 'TRISC', 4], |
251
|
|
|
|
|
|
|
RC5 => ['PORTC', 'TRISC', 5], |
252
|
|
|
|
|
|
|
RC6 => ['PORTC', 'TRISC', 6], |
253
|
|
|
|
|
|
|
RC7 => ['PORTC', 'TRISC', 7], |
254
|
|
|
|
|
|
|
RD0 => ['PORTD', 'TRISD', 0], |
255
|
|
|
|
|
|
|
RD1 => ['PORTD', 'TRISD', 1], |
256
|
|
|
|
|
|
|
RD2 => ['PORTD', 'TRISD', 2], |
257
|
|
|
|
|
|
|
RD3 => ['PORTD', 'TRISD', 3], |
258
|
|
|
|
|
|
|
RD4 => ['PORTD', 'TRISD', 4], |
259
|
|
|
|
|
|
|
RD5 => ['PORTD', 'TRISD', 5], |
260
|
|
|
|
|
|
|
RD6 => ['PORTD', 'TRISD', 6], |
261
|
|
|
|
|
|
|
RD7 => ['PORTD', 'TRISD', 7], |
262
|
|
|
|
|
|
|
RE0 => ['PORTE', 'TRISE', 0], |
263
|
|
|
|
|
|
|
RE1 => ['PORTE', 'TRISE', 1], |
264
|
|
|
|
|
|
|
RE2 => ['PORTE', 'TRISE', 2], |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
}); |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
has analog_pins => (is => 'ro', default => sub { |
269
|
|
|
|
|
|
|
{ |
270
|
|
|
|
|
|
|
# use ANSEL for pins AN0-AN7 and ANSELH for AN8-AN11 |
271
|
|
|
|
|
|
|
#pin => number, bit |
272
|
|
|
|
|
|
|
AN0 => [2, 0], |
273
|
|
|
|
|
|
|
AN1 => [3, 1], |
274
|
|
|
|
|
|
|
AN2 => [4, 2], |
275
|
|
|
|
|
|
|
AN3 => [5, 3], |
276
|
|
|
|
|
|
|
AN4 => [7, 4], |
277
|
|
|
|
|
|
|
AN5 => [8, 5], |
278
|
|
|
|
|
|
|
AN6 => [9, 6], |
279
|
|
|
|
|
|
|
AN7 => [10, 7], |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
}); |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
has adc_channels => (is => 'ro', default => 8); |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
has adc_chs_bits => (is => 'ro', default => sub { |
286
|
|
|
|
|
|
|
{ |
287
|
|
|
|
|
|
|
#pin => chsbits |
288
|
|
|
|
|
|
|
AN0 => '0000', |
289
|
|
|
|
|
|
|
AN1 => '0001', |
290
|
|
|
|
|
|
|
AN2 => '0010', |
291
|
|
|
|
|
|
|
AN3 => '0011', |
292
|
|
|
|
|
|
|
AN4 => '0100', |
293
|
|
|
|
|
|
|
AN5 => '0101', |
294
|
|
|
|
|
|
|
AN6 => '0110', |
295
|
|
|
|
|
|
|
AN7 => '0111', |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
}); |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
has timer_pins => (is => 'ro', default => sub { |
300
|
|
|
|
|
|
|
{ |
301
|
|
|
|
|
|
|
TMR0 => { reg => 'TMR0', freg => 'INTCON', flag => 'TMR0IF', enable => 'TMR0IE', ereg => 'INTCON' }, |
302
|
|
|
|
|
|
|
TMR1 => { reg => ['TMR1H', 'TMR1L'], freg => 'PIR1', ereg => 'PIE1', flag => 'TMR1IF', enable => 'TMR1E' }, |
303
|
|
|
|
|
|
|
TMR2 => { reg => 'TMR2', freg => 'PIR1', flag => 'TMR2IF', enable => 'TMR2IE', ereg => 'PIE1' }, |
304
|
|
|
|
|
|
|
TMR3 => { reg => ['TMR3H', 'TMR3L'], freg => 'PIR2', ereg => 'PIE2', flag => 'TMR3IF', enable => 'TMR3E' }, |
305
|
|
|
|
|
|
|
T0CKI => 6, |
306
|
|
|
|
|
|
|
T1OSO => 15, |
307
|
|
|
|
|
|
|
T1CKI => 15, |
308
|
|
|
|
|
|
|
T1OSI => 16, |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
}); |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
has ccp_pins => (is => 'ro', default => sub { |
313
|
|
|
|
|
|
|
{ |
314
|
|
|
|
|
|
|
# multiple pins for multiplexing |
315
|
|
|
|
|
|
|
CCP2 => [36, 16], |
316
|
|
|
|
|
|
|
CCP1 => 17, |
317
|
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
|
}); |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
#external interrupt |
321
|
|
|
|
|
|
|
has eint_pins => (is => 'ro', default => sub { |
322
|
|
|
|
|
|
|
{ |
323
|
|
|
|
|
|
|
INT0 => 33, |
324
|
|
|
|
|
|
|
INT1 => 34, |
325
|
|
|
|
|
|
|
INT2 => 35, |
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
}); |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
has ioc_pins => (is => 'ro', default => sub { |
330
|
|
|
|
|
|
|
{ |
331
|
|
|
|
|
|
|
RB4 => [37], |
332
|
|
|
|
|
|
|
RB5 => [38], |
333
|
|
|
|
|
|
|
RB6 => [39], |
334
|
|
|
|
|
|
|
RB7 => [40], |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
}); |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
has ioc_ports => (is => 'ro', default => sub { |
339
|
|
|
|
|
|
|
{ |
340
|
|
|
|
|
|
|
FLAG => 'RBIF', |
341
|
|
|
|
|
|
|
ENABLE => 'RBIE', |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
}); |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
has selector_pins => (is => 'ro', default => sub { |
346
|
|
|
|
|
|
|
{ |
347
|
|
|
|
|
|
|
spi_or_i2c => 'SS', |
348
|
|
|
|
|
|
|
psp_read => 'RD', |
349
|
|
|
|
|
|
|
psp_write => 'WR', |
350
|
|
|
|
|
|
|
psp => 'CS', |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
}); |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
has psp_pins => (is => 'ro', default => sub { |
355
|
|
|
|
|
|
|
{ |
356
|
|
|
|
|
|
|
0 => 'PSP0', |
357
|
|
|
|
|
|
|
1 => 'PSP1', |
358
|
|
|
|
|
|
|
2 => 'PSP2', |
359
|
|
|
|
|
|
|
3 => 'PSP3', |
360
|
|
|
|
|
|
|
4 => 'PSP4', |
361
|
|
|
|
|
|
|
5 => 'PSP5', |
362
|
|
|
|
|
|
|
6 => 'PSP6', |
363
|
|
|
|
|
|
|
7 => 'PSP7', |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
}); |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
my @rolenames = qw(CodeGen Operators Chip GPIO ADC ISR Timer Operations CCP |
368
|
|
|
|
|
|
|
USART SPI I2C PSP); |
369
|
|
|
|
|
|
|
my @roles = map (("VIC::PIC::Roles::$_", "VIC::PIC::Functions::$_"), @rolenames); |
370
|
|
|
|
|
|
|
with @roles; |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
sub list_roles { |
373
|
2
|
|
|
2
|
0
|
3234
|
my @arr = grep {!/CodeGen|Oper|Chip|ISR/} @rolenames; |
|
26
|
|
|
|
|
85
|
|
374
|
2
|
50
|
|
|
|
27
|
return wantarray ? @arr : [@arr]; |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
1; |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=encoding utf8 |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
=head1 NAME |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
VIC::PIC::P18F442 |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=head1 SYNOPSIS |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
A class that describes the code to be generated for each specific |
388
|
|
|
|
|
|
|
microcontroller that maps the VIC syntax back into assembly. This is the |
389
|
|
|
|
|
|
|
back-end to VIC's front-end. |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=head1 DESCRIPTION |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
INTERNAL CLASS. |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=head1 AUTHOR |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
Vikas N Kumar |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=head1 COPYRIGHT |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
Copyright (c) 2014. Vikas N Kumar |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
404
|
|
|
|
|
|
|
under the same terms as Perl itself. |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
See http://www.perl.com/perl/misc/Artistic.html |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
=cut |