line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VIC::PIC::P16F685; |
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.31'; |
5
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
6
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
extends 'VIC::PIC::Base'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# role CodeGen |
10
|
|
|
|
|
|
|
has type => (is => 'ro', default => 'p16f685'); |
11
|
|
|
|
|
|
|
has include => (is => 'ro', default => 'p16f685.inc'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#role Chip |
14
|
|
|
|
|
|
|
has f_osc => (is => 'ro', default => 4e6); # 4MHz internal oscillator |
15
|
|
|
|
|
|
|
has pcl_size => (is => 'ro', default => 13); # program counter (PCL) size |
16
|
|
|
|
|
|
|
has stack_size => (is => 'ro', default => 8); # 8 levels of 13-bit entries |
17
|
|
|
|
|
|
|
has wreg_size => (is => 'ro', default => 8); # 8-bit register WREG |
18
|
|
|
|
|
|
|
# all memory is in bytes |
19
|
|
|
|
|
|
|
has memory => (is => 'ro', default => sub { |
20
|
|
|
|
|
|
|
{ |
21
|
|
|
|
|
|
|
flash => 4096, #words |
22
|
|
|
|
|
|
|
SRAM => 256, |
23
|
|
|
|
|
|
|
EEPROM => 256, |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
}); |
26
|
|
|
|
|
|
|
has address => (is => 'ro', default => sub { |
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
isr => [ 0x0004 ], |
29
|
|
|
|
|
|
|
reset => [ 0x0000 ], |
30
|
|
|
|
|
|
|
range => [ 0x0000, 0x0FFF ], |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
}); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has pin_counts => (is => 'ro', default => sub { { |
35
|
|
|
|
|
|
|
pdip => 20, ## PDIP or DIP ? |
36
|
|
|
|
|
|
|
soic => 20, |
37
|
|
|
|
|
|
|
ssop => 20, |
38
|
|
|
|
|
|
|
total => 20, |
39
|
|
|
|
|
|
|
io => 18, |
40
|
|
|
|
|
|
|
}}); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has banks => (is => 'ro', default => sub { |
43
|
|
|
|
|
|
|
{ |
44
|
|
|
|
|
|
|
count => 4, |
45
|
|
|
|
|
|
|
size => 0x80, |
46
|
|
|
|
|
|
|
gpr => { |
47
|
|
|
|
|
|
|
0 => [ 0x020, 0x07F], |
48
|
|
|
|
|
|
|
1 => [ 0x0A0, 0x0EF], |
49
|
|
|
|
|
|
|
2 => [ 0x120, 0x16F], |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
# remapping of these addresses automatically done by chip |
52
|
|
|
|
|
|
|
common => [0x070, 0x07F], |
53
|
|
|
|
|
|
|
remap => [ |
54
|
|
|
|
|
|
|
[0x0F0, 0x0FF], |
55
|
|
|
|
|
|
|
[0x170, 0x17F], |
56
|
|
|
|
|
|
|
[0x1F0, 0x1FF], |
57
|
|
|
|
|
|
|
], |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
}); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has registers => (is => 'ro', default => sub { |
62
|
|
|
|
|
|
|
{ |
63
|
|
|
|
|
|
|
INDF => [0x000, 0x080, 0x100, 0x180], # indirect addressing |
64
|
|
|
|
|
|
|
TMR0 => [0x001, 0x101], |
65
|
|
|
|
|
|
|
OPTION_REG => [0x081, 0x181], |
66
|
|
|
|
|
|
|
PCL => [0x002, 0x082, 0x102, 0x182], |
67
|
|
|
|
|
|
|
STATUS => [0x003, 0x083, 0x103, 0x183], |
68
|
|
|
|
|
|
|
FSR => [0x004, 0x084, 0x104, 0x184], |
69
|
|
|
|
|
|
|
PORTA => [0x005, 0x105], |
70
|
|
|
|
|
|
|
TRISA => [0x085, 0x185], |
71
|
|
|
|
|
|
|
PORTB => [0x006, 0x106], |
72
|
|
|
|
|
|
|
TRISB => [0x086, 0x186], |
73
|
|
|
|
|
|
|
PORTC => [0x007, 0x107], |
74
|
|
|
|
|
|
|
TRISC => [0x087, 0x187], |
75
|
|
|
|
|
|
|
PCLATH => [0x00A, 0x08A, 0x10A, 0x18A], |
76
|
|
|
|
|
|
|
INTCON => [0x00B, 0x08B, 0x10B, 0x18B], |
77
|
|
|
|
|
|
|
PIR1 => [0x00C], |
78
|
|
|
|
|
|
|
PIE1 => [0x08C], |
79
|
|
|
|
|
|
|
EEDAT => [0x10C], |
80
|
|
|
|
|
|
|
EECON1 => [0x18C], |
81
|
|
|
|
|
|
|
PIR2 => [0x00D], |
82
|
|
|
|
|
|
|
PIE2 => [0x08D], |
83
|
|
|
|
|
|
|
EEADR => [0x10D], |
84
|
|
|
|
|
|
|
EECON2 => [0x18D], # not addressable apparently |
85
|
|
|
|
|
|
|
TMR1L => [0x00E], |
86
|
|
|
|
|
|
|
PCON => [0x08E], |
87
|
|
|
|
|
|
|
EEDATH => [0x10E], |
88
|
|
|
|
|
|
|
TMR1H => [0x00F], |
89
|
|
|
|
|
|
|
OSCCON => [0x08F], |
90
|
|
|
|
|
|
|
EEADRH => [0x10F], |
91
|
|
|
|
|
|
|
T1CON => [0x010], |
92
|
|
|
|
|
|
|
OSCTUNE => [0x090], |
93
|
|
|
|
|
|
|
TMR2 => [0x011], |
94
|
|
|
|
|
|
|
T2CON => [0x012], |
95
|
|
|
|
|
|
|
PR2 => [0x092], |
96
|
|
|
|
|
|
|
CCPR1L => [0x015], |
97
|
|
|
|
|
|
|
WPUA => [0x095], |
98
|
|
|
|
|
|
|
WPUB => [0x115], |
99
|
|
|
|
|
|
|
CCPR1H => [0x016], |
100
|
|
|
|
|
|
|
IOCA => [0x096], |
101
|
|
|
|
|
|
|
IOCB => [0x116], |
102
|
|
|
|
|
|
|
CCP1CON => [0x017], |
103
|
|
|
|
|
|
|
WDTCON => [0x097], |
104
|
|
|
|
|
|
|
VRCON => [0x118], |
105
|
|
|
|
|
|
|
CM1CON0 => [0x119], |
106
|
|
|
|
|
|
|
CM2CON0 => [0x11A], |
107
|
|
|
|
|
|
|
CM2CON1 => [0x11B], |
108
|
|
|
|
|
|
|
PWM1CON => [0x01C], |
109
|
|
|
|
|
|
|
ECCPAS => [0x01D], |
110
|
|
|
|
|
|
|
PSTRCON => [0x19D], |
111
|
|
|
|
|
|
|
ADRESH => [0x01E], |
112
|
|
|
|
|
|
|
ADRESL => [0x09E], |
113
|
|
|
|
|
|
|
ANSEL => [0x11E], |
114
|
|
|
|
|
|
|
SRCON => [0x19E], |
115
|
|
|
|
|
|
|
ADCON0 => [0x01F], |
116
|
|
|
|
|
|
|
ADCON1 => [0x09F], |
117
|
|
|
|
|
|
|
ANSELH => [0x11F], |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
}); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
has pins => (is => 'ro', default => sub { |
122
|
|
|
|
|
|
|
my $h = { |
123
|
|
|
|
|
|
|
# number to pin name and pin name to number |
124
|
|
|
|
|
|
|
1 => [qw(Vdd)], |
125
|
|
|
|
|
|
|
2 => [qw(RA5 T1CKI OSC1 CLKIN)], |
126
|
|
|
|
|
|
|
3 => [qw(RA4 AN3 T1G OSC2 CLKOUT)], |
127
|
|
|
|
|
|
|
4 => [qw(RA3 MCLR Vpp)], |
128
|
|
|
|
|
|
|
5 => [qw(RC5 CCP1 P1A)], |
129
|
|
|
|
|
|
|
6 => [qw(RC4 C2OUT P1B)], |
130
|
|
|
|
|
|
|
7 => [qw(RC3 AN7 C12IN3- P1C)], |
131
|
|
|
|
|
|
|
8 => [qw(RC6 AN8)], |
132
|
|
|
|
|
|
|
9 => [qw(RC7 AN9)], |
133
|
|
|
|
|
|
|
10 => [qw(RB7)], |
134
|
|
|
|
|
|
|
11 => [qw(RB6)], |
135
|
|
|
|
|
|
|
12 => [qw(RB5 AN11)], |
136
|
|
|
|
|
|
|
13 => [qw(RB4 AN10)], |
137
|
|
|
|
|
|
|
14 => [qw(RC2 AN6 C12IN2- P1D)], |
138
|
|
|
|
|
|
|
15 => [qw(RC1 AN5 C12IN1-)], |
139
|
|
|
|
|
|
|
16 => [qw(RC0 AN4 C2IN+)], |
140
|
|
|
|
|
|
|
17 => [qw(RA2 AN2 T0CKI INT C1OUT)], |
141
|
|
|
|
|
|
|
18 => [qw(RA1 AN1 C12IN0- Vref ICSPCLK)], |
142
|
|
|
|
|
|
|
19 => [qw(RA0 AN0 C1N+ ICSPDAT ULPWU)], |
143
|
|
|
|
|
|
|
20 => [qw(Vss)], |
144
|
|
|
|
|
|
|
}; |
145
|
|
|
|
|
|
|
foreach my $k (keys %$h) { |
146
|
|
|
|
|
|
|
my $v = $h->{$k}; |
147
|
|
|
|
|
|
|
foreach (@$v) { |
148
|
|
|
|
|
|
|
$h->{$_} = $k; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
return $h; |
152
|
|
|
|
|
|
|
}); |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
has clock_pins => (is => 'ro', default => sub { |
155
|
|
|
|
|
|
|
{ |
156
|
|
|
|
|
|
|
out => 'CLKOUT', |
157
|
|
|
|
|
|
|
in => 'CLKIN', |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
}); |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
has oscillator_pins => (is => 'ro', default => sub { |
162
|
|
|
|
|
|
|
{ |
163
|
|
|
|
|
|
|
1 => 'OSC1', |
164
|
|
|
|
|
|
|
2 => 'OSC2', |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
}); |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
has program_pins => (is => 'ro', default => sub { |
169
|
|
|
|
|
|
|
{ |
170
|
|
|
|
|
|
|
clock => 'ICSPCLK', |
171
|
|
|
|
|
|
|
data => 'ICSPDAT', |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
}); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
has io_ports => (is => 'ro', default => sub { |
176
|
|
|
|
|
|
|
{ |
177
|
|
|
|
|
|
|
#port => tristate, |
178
|
|
|
|
|
|
|
PORTA => 'TRISA', |
179
|
|
|
|
|
|
|
PORTB => 'TRISB', |
180
|
|
|
|
|
|
|
PORTC => 'TRISC', |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
}); |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
has input_pins => (is => 'ro', default => sub { |
185
|
|
|
|
|
|
|
{ |
186
|
|
|
|
|
|
|
#I/O => [port, tristate, bit] |
187
|
|
|
|
|
|
|
RA0 => ['PORTA', 'TRISA', 0], |
188
|
|
|
|
|
|
|
RA1 => ['PORTA', 'TRISA', 1], |
189
|
|
|
|
|
|
|
RA2 => ['PORTA', 'TRISA', 2], |
190
|
|
|
|
|
|
|
RA3 => ['PORTA', 'TRISA', 3], # input only |
191
|
|
|
|
|
|
|
RA4 => ['PORTA', 'TRISA', 4], |
192
|
|
|
|
|
|
|
RA5 => ['PORTA', 'TRISA', 5], |
193
|
|
|
|
|
|
|
RB4 => ['PORTB', 'TRISB', 4], |
194
|
|
|
|
|
|
|
RB5 => ['PORTB', 'TRISB', 5], |
195
|
|
|
|
|
|
|
RB6 => ['PORTB', 'TRISB', 6], |
196
|
|
|
|
|
|
|
RB7 => ['PORTB', 'TRISB', 7], |
197
|
|
|
|
|
|
|
RC0 => ['PORTC', 'TRISC', 0], |
198
|
|
|
|
|
|
|
RC1 => ['PORTC', 'TRISC', 1], |
199
|
|
|
|
|
|
|
RC2 => ['PORTC', 'TRISC', 2], |
200
|
|
|
|
|
|
|
RC3 => ['PORTC', 'TRISC', 3], |
201
|
|
|
|
|
|
|
RC4 => ['PORTC', 'TRISC', 4], |
202
|
|
|
|
|
|
|
RC5 => ['PORTC', 'TRISC', 5], |
203
|
|
|
|
|
|
|
RC6 => ['PORTC', 'TRISC', 6], |
204
|
|
|
|
|
|
|
RC7 => ['PORTC', 'TRISC', 7], |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
}); |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
has output_pins => (is => 'ro', default => sub { |
209
|
|
|
|
|
|
|
{ |
210
|
|
|
|
|
|
|
#I/O => [port, tristate, bit] |
211
|
|
|
|
|
|
|
RA0 => ['PORTA', 'TRISA', 0], |
212
|
|
|
|
|
|
|
RA1 => ['PORTA', 'TRISA', 1], |
213
|
|
|
|
|
|
|
RA2 => ['PORTA', 'TRISA', 2], |
214
|
|
|
|
|
|
|
RA4 => ['PORTA', 'TRISA', 4], |
215
|
|
|
|
|
|
|
RA5 => ['PORTA', 'TRISA', 5], |
216
|
|
|
|
|
|
|
RB4 => ['PORTB', 'TRISB', 4], |
217
|
|
|
|
|
|
|
RB5 => ['PORTB', 'TRISB', 5], |
218
|
|
|
|
|
|
|
RB6 => ['PORTB', 'TRISB', 6], |
219
|
|
|
|
|
|
|
RB7 => ['PORTB', 'TRISB', 7], |
220
|
|
|
|
|
|
|
RC0 => ['PORTC', 'TRISC', 0], |
221
|
|
|
|
|
|
|
RC1 => ['PORTC', 'TRISC', 1], |
222
|
|
|
|
|
|
|
RC2 => ['PORTC', 'TRISC', 2], |
223
|
|
|
|
|
|
|
RC3 => ['PORTC', 'TRISC', 3], |
224
|
|
|
|
|
|
|
RC4 => ['PORTC', 'TRISC', 4], |
225
|
|
|
|
|
|
|
RC5 => ['PORTC', 'TRISC', 5], |
226
|
|
|
|
|
|
|
RC6 => ['PORTC', 'TRISC', 6], |
227
|
|
|
|
|
|
|
RC7 => ['PORTC', 'TRISC', 7], |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
}); |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
has analog_pins => (is => 'ro', default => sub { |
232
|
|
|
|
|
|
|
{ |
233
|
|
|
|
|
|
|
# use ANSEL for pins AN0-AN7 and ANSELH for AN8-AN11 |
234
|
|
|
|
|
|
|
#pin => number, bit |
235
|
|
|
|
|
|
|
AN0 => [19, 0], |
236
|
|
|
|
|
|
|
AN1 => [18, 1], |
237
|
|
|
|
|
|
|
AN2 => [17, 2], |
238
|
|
|
|
|
|
|
AN3 => [3, 3], |
239
|
|
|
|
|
|
|
AN4 => [16, 4], |
240
|
|
|
|
|
|
|
AN5 => [15, 5], |
241
|
|
|
|
|
|
|
AN6 => [14, 6], |
242
|
|
|
|
|
|
|
AN7 => [ 7, 7], |
243
|
|
|
|
|
|
|
AN8 => [ 8, 8], |
244
|
|
|
|
|
|
|
AN9 => [ 9, 9], |
245
|
|
|
|
|
|
|
AN10 => [13, 10], |
246
|
|
|
|
|
|
|
AN11 => [12, 12], |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
}); |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
has adc_channels => (is => 'ro', default => 12); |
251
|
|
|
|
|
|
|
has adcs_bits => (is => 'ro', default => sub { |
252
|
|
|
|
|
|
|
{ |
253
|
|
|
|
|
|
|
2 => '000', |
254
|
|
|
|
|
|
|
4 => '100', |
255
|
|
|
|
|
|
|
8 => '001', |
256
|
|
|
|
|
|
|
16 => '101', |
257
|
|
|
|
|
|
|
32 => '010', |
258
|
|
|
|
|
|
|
64 => '110', |
259
|
|
|
|
|
|
|
internal => '111', |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
}); |
262
|
|
|
|
|
|
|
has adc_chs_bits => (is => 'ro', default => sub { |
263
|
|
|
|
|
|
|
{ |
264
|
|
|
|
|
|
|
#pin => chsbits |
265
|
|
|
|
|
|
|
AN0 => '0000', |
266
|
|
|
|
|
|
|
AN1 => '0001', |
267
|
|
|
|
|
|
|
AN2 => '0010', |
268
|
|
|
|
|
|
|
AN3 => '0011', |
269
|
|
|
|
|
|
|
AN4 => '0100', |
270
|
|
|
|
|
|
|
AN5 => '0101', |
271
|
|
|
|
|
|
|
AN6 => '0110', |
272
|
|
|
|
|
|
|
AN7 => '0111', |
273
|
|
|
|
|
|
|
AN8 => '1000', |
274
|
|
|
|
|
|
|
AN9 => '1001', |
275
|
|
|
|
|
|
|
AN10 => '1010', |
276
|
|
|
|
|
|
|
AN11 => '1011', |
277
|
|
|
|
|
|
|
CVref => '1100', |
278
|
|
|
|
|
|
|
'0.6V' => '1101', |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
}); |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
has timer_prescaler => (is => 'ro', default => sub { |
283
|
|
|
|
|
|
|
{ |
284
|
|
|
|
|
|
|
2 => '000', |
285
|
|
|
|
|
|
|
4 => '001', |
286
|
|
|
|
|
|
|
8 => '010', |
287
|
|
|
|
|
|
|
16 => '011', |
288
|
|
|
|
|
|
|
32 => '100', |
289
|
|
|
|
|
|
|
64 => '101', |
290
|
|
|
|
|
|
|
128 => '110', |
291
|
|
|
|
|
|
|
256 => '111', |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
}); |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
has wdt_prescaler => (is => 'ro', default => sub { |
296
|
|
|
|
|
|
|
{ |
297
|
|
|
|
|
|
|
1 => '000', |
298
|
|
|
|
|
|
|
2 => '001', |
299
|
|
|
|
|
|
|
4 => '010', |
300
|
|
|
|
|
|
|
8 => '011', |
301
|
|
|
|
|
|
|
16 => '100', |
302
|
|
|
|
|
|
|
32 => '101', |
303
|
|
|
|
|
|
|
64 => '110', |
304
|
|
|
|
|
|
|
128 => '111', |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
}); |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
has timer_pins => (is => 'ro', default => sub { |
309
|
|
|
|
|
|
|
{ |
310
|
|
|
|
|
|
|
#reg #reg #ireg #flag #enable |
311
|
|
|
|
|
|
|
TMR0 => { reg => 'TMR0', freg => 'INTCON', flag => 'T0IF', enable => 'T0IE', ereg => 'INTCON' }, |
312
|
|
|
|
|
|
|
TMR1 => { reg => ['TMR1H', 'TMR1L'], freg => 'PIR1', ereg => 'PIE1', flag => 'TMR1IF', enable => 'TMR1E' }, |
313
|
|
|
|
|
|
|
TMR2 => { reg => 'TMR2', freg => 'PIR1', flag => 'TMR2IF', enable => 'TMR2IE', ereg => 'PIE1' }, |
314
|
|
|
|
|
|
|
T0CKI => 17, |
315
|
|
|
|
|
|
|
T1CKI => 2, |
316
|
|
|
|
|
|
|
T1G => 3, |
317
|
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
|
}); |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
has eccp_pins => (is => 'ro', default => sub { |
321
|
|
|
|
|
|
|
{ # pin => pin_no, tris, bit |
322
|
|
|
|
|
|
|
P1D => [14, 'TRISC', 2], |
323
|
|
|
|
|
|
|
P1C => [7, 'TRISC', 3], |
324
|
|
|
|
|
|
|
P1B => [6, 'TRISC', 4], |
325
|
|
|
|
|
|
|
P1A => [5, 'TRISC', 5], |
326
|
|
|
|
|
|
|
CCP1 => [5, 'TRISC', 5], |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
}); |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
#external interrupt |
331
|
|
|
|
|
|
|
has eint_pins => (is => 'ro', default => sub { |
332
|
|
|
|
|
|
|
{ |
333
|
|
|
|
|
|
|
INT => 17, |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
}); |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
has ioc_pins => (is => 'ro', default => sub { |
338
|
|
|
|
|
|
|
{ |
339
|
|
|
|
|
|
|
#pin, #ioc-bit #ioc-reg |
340
|
|
|
|
|
|
|
RA0 => [19, 'IOCA0', 'IOCA'], |
341
|
|
|
|
|
|
|
RA1 => [18, 'IOCA1', 'IOCA'], |
342
|
|
|
|
|
|
|
RA2 => [17, 'IOCA2', 'IOCA'], |
343
|
|
|
|
|
|
|
RA3 => [4, 'IOCA3', 'IOCA'], |
344
|
|
|
|
|
|
|
RA4 => [3, 'IOCA4', 'IOCA'], |
345
|
|
|
|
|
|
|
RA5 => [2, 'IOCA5', 'IOCA'], |
346
|
|
|
|
|
|
|
RB4 => [13, 'IOCB4', 'IOCB'], |
347
|
|
|
|
|
|
|
RB5 => [12, 'IOCB5', 'IOCB'], |
348
|
|
|
|
|
|
|
RB6 => [11, 'IOCB6', 'IOCB'], |
349
|
|
|
|
|
|
|
RB7 => [10, 'IOCB7', 'IOCB'], |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
}); |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
has ioc_ports => (is => 'ro', default => sub { |
354
|
|
|
|
|
|
|
{ |
355
|
|
|
|
|
|
|
PORTA => 'IOCA', |
356
|
|
|
|
|
|
|
PORTB => 'IOCB', |
357
|
|
|
|
|
|
|
FLAG => 'RABIF', |
358
|
|
|
|
|
|
|
ENABLE => 'RABIE', |
359
|
|
|
|
|
|
|
} |
360
|
|
|
|
|
|
|
}); |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
has cmp_input_pins => (is => 'ro', default => sub { |
363
|
|
|
|
|
|
|
{ |
364
|
|
|
|
|
|
|
'C1IN+' => 'C1IN+', |
365
|
|
|
|
|
|
|
'C12IN0-' => 'C12IN0-', |
366
|
|
|
|
|
|
|
'C2IN+' => 'C2IN+', |
367
|
|
|
|
|
|
|
'C12IN1-' => 'C12IN1-', |
368
|
|
|
|
|
|
|
'C12IN2-' => 'C12IN2-', |
369
|
|
|
|
|
|
|
'C12IN3-' => 'C12IN3-', |
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
}); |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
has cmp_output_pins => (is => 'ro', default => sub { |
374
|
|
|
|
|
|
|
{ |
375
|
|
|
|
|
|
|
C1OUT => 'C1OUT', |
376
|
|
|
|
|
|
|
C2OUT => 'C2OUT', |
377
|
|
|
|
|
|
|
} |
378
|
|
|
|
|
|
|
}); |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
my @rolenames = qw(CodeGen Operators Chip GPIO ADC ISR Timer Operations ECCP |
381
|
|
|
|
|
|
|
Comparator); |
382
|
|
|
|
|
|
|
my @roles = map (("VIC::PIC::Roles::$_", "VIC::PIC::Functions::$_"), @rolenames); |
383
|
|
|
|
|
|
|
with @roles; |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
sub list_roles { |
386
|
1
|
|
|
1
|
0
|
1137
|
my @arr = grep {!/CodeGen|Oper|Chip|ISR/} @rolenames; |
|
10
|
|
|
|
|
20
|
|
387
|
1
|
50
|
|
|
|
9
|
return wantarray ? @arr : [@arr]; |
388
|
|
|
|
|
|
|
} |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
1; |
391
|
|
|
|
|
|
|
__END__ |