-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path16f628a.html
More file actions
256 lines (248 loc) · 12 KB
/
16f628a.html
File metadata and controls
256 lines (248 loc) · 12 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!-- Generated 05/01/2024 GMT -->
<!--
Copyright © 2024, Microchip Technology Inc. and its subsidiaries ("Microchip")
All rights reserved.
This software is developed by Microchip Technology Inc. and its subsidiaries ("Microchip").
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution. Publication is not required when
this file is used in an embedded application.
3. Microchip's name may not be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY MICROCHIP "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MICROCHIP BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS
INTERRUPTION) HOWSOEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<HTML>
<HEAD>
<TITLE>Microchip MPLAB XC8 C Compiler: 16F628A Support Information</TITLE>
</HEAD>
<BODY>
<h2>16F628A Support Information</h2>
<h3>XC8-CC #pragma config Usage</h3>
<table bgcolor="lightgray" width="100%" cellpadding="10">
<tbody>
<th colspan="1">
<div align="left"><tt>#pragma config <setting>=<named value></tt></div>
</th>
<tr bgcolor="white">
<td>For example:<br/><code>// Oscillator Selection bits : RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN<br/>// Watchdog Timer Enable bit : WDT enabled<br/>// Power-up Timer Enable bit : PWRT disabled<br/>// RA5/MCLR/VPP Pin Function Select bit : RA5/MCLR/VPP pin function is MCLR<br/>// Brown-out Detect Enable bit : BOD enabled<br/>// Low-Voltage Programming Enable bit : RB4/PGM pin has PGM function, low-voltage programming enabled<br/>// Data EE Memory Code Protection bit : Data memory code protection off<br/>// Flash Program Memory Code Protection bit : Code protection off<br/>#pragma config FOSC = EXTRCCLK, WDTE = ON, PWRTE = OFF, MCLRE = ON, BOREN = ON, LVP = ON, CPD = OFF, CP = OFF</code></td>
</tr>
</tbody></table>
<table bgcolor="lightgray" width="100%" cellpadding="10">
<tbody>
<th colspan="1">
<div align="left"><tt>#pragma config <setting>=<literal constant></tt></div>
</th>
<tr bgcolor="white">
<td>For example:<br/><code>// Oscillator Selection bits : RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN<br/>// Watchdog Timer Enable bit : WDT enabled<br/>// Power-up Timer Enable bit : PWRT disabled<br/>// RA5/MCLR/VPP Pin Function Select bit : RA5/MCLR/VPP pin function is MCLR<br/>// Brown-out Detect Enable bit : BOD enabled<br/>// Low-Voltage Programming Enable bit : RB4/PGM pin has PGM function, low-voltage programming enabled<br/>// Data EE Memory Code Protection bit : Data memory code protection off<br/>// Flash Program Memory Code Protection bit : Code protection off<br/>#pragma config FOSC = 0x13, WDTE = 0x1, PWRTE = 0x1, MCLRE = 0x1, BOREN = 0x1, LVP = 0x1, CPD = 0x1, CP = 0x1</code></td>
</tr>
</tbody></table>
<table bgcolor="lightgray" width="100%" cellpadding="10">
<tbody>
<th colspan="1">
<div align="left"><tt>#pragma config <register>=<literal constant></tt></div>
</th>
<tr bgcolor="white">
<td>For example:<br/><code>// Oscillator Selection bits : RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN<br/>// Watchdog Timer Enable bit : WDT enabled<br/>// Power-up Timer Enable bit : PWRT disabled<br/>// RA5/MCLR/VPP Pin Function Select bit : RA5/MCLR/VPP pin function is MCLR<br/>// Brown-out Detect Enable bit : BOD enabled<br/>// Low-Voltage Programming Enable bit : RB4/PGM pin has PGM function, low-voltage programming enabled<br/>// Data EE Memory Code Protection bit : Data memory code protection off<br/>// Flash Program Memory Code Protection bit : Code protection off<br/>#pragma config CONFIG = 0x3FFF</code></td>
</tr>
<tr bgcolor="white">
<td>For example:<br/><code>// IDLOC @ 0x2000<br/>#pragma config IDLOC0 = 0x127</code></td>
</tr>
</tbody></table>
<br/>
<h3>PIC-AS config Usage</h3>
<table bgcolor="lightgray" width="100%" cellpadding="10">
<tbody>
<th colspan="1">
<div align="left"><tt>config "<setting>"="<named value>"</tt></div>
</th>
<tr bgcolor="white">
<td>For example:<br/><code>; Oscillator Selection bits : RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN<br/>; Watchdog Timer Enable bit : WDT enabled<br/>; Power-up Timer Enable bit : PWRT disabled<br/>; RA5/MCLR/VPP Pin Function Select bit : RA5/MCLR/VPP pin function is MCLR<br/>; Brown-out Detect Enable bit : BOD enabled<br/>; Low-Voltage Programming Enable bit : RB4/PGM pin has PGM function, low-voltage programming enabled<br/>; Data EE Memory Code Protection bit : Data memory code protection off<br/>; Flash Program Memory Code Protection bit : Code protection off<br/>config "FOSC" = "EXTRCCLK", "WDTE" = "ON", "PWRTE" = "OFF", "MCLRE" = "ON", "BOREN" = "ON", "LVP" = "ON", "CPD" = "OFF", "CP" = "OFF"</code></td>
</tr>
</tbody></table>
<table bgcolor="lightgray" width="100%" cellpadding="10">
<tbody>
<th colspan="1">
<div align="left"><tt>config "<setting>"=<literal constant></tt></div>
</th>
<tr bgcolor="white">
<td>For example:<br/><code>; Oscillator Selection bits : RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN<br/>; Watchdog Timer Enable bit : WDT enabled<br/>; Power-up Timer Enable bit : PWRT disabled<br/>; RA5/MCLR/VPP Pin Function Select bit : RA5/MCLR/VPP pin function is MCLR<br/>; Brown-out Detect Enable bit : BOD enabled<br/>; Low-Voltage Programming Enable bit : RB4/PGM pin has PGM function, low-voltage programming enabled<br/>; Data EE Memory Code Protection bit : Data memory code protection off<br/>; Flash Program Memory Code Protection bit : Code protection off<br/>config "FOSC" = 0x13, "WDTE" = 0x1, "PWRTE" = 0x1, "MCLRE" = 0x1, "BOREN" = 0x1, "LVP" = 0x1, "CPD" = 0x1, "CP" = 0x1</code></td>
</tr>
</tbody></table>
<table bgcolor="lightgray" width="100%" cellpadding="10">
<tbody>
<th colspan="1">
<div align="left"><tt>config "<register>"=<literal constant></tt></div>
</th>
<tr bgcolor="white">
<td>For example:<br/><code>; Oscillator Selection bits : RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN<br/>; Watchdog Timer Enable bit : WDT enabled<br/>; Power-up Timer Enable bit : PWRT disabled<br/>; RA5/MCLR/VPP Pin Function Select bit : RA5/MCLR/VPP pin function is MCLR<br/>; Brown-out Detect Enable bit : BOD enabled<br/>; Low-Voltage Programming Enable bit : RB4/PGM pin has PGM function, low-voltage programming enabled<br/>; Data EE Memory Code Protection bit : Data memory code protection off<br/>; Flash Program Memory Code Protection bit : Code protection off<br/>config "CONFIG" = 0x3FFF</code></td>
</tr>
<tr bgcolor="white">
<td>For example:<br/><code>; IDLOC @ 0x2000<br/>config "IDLOC0" = 0x127</code></td>
</tr>
</tbody></table>
<br/>
<h3>Configuration Registers & Settings</h3>
<table bgcolor="lightgray" width="100%" cellpadding="2">
<tbody>
<th colspan="2">
<div align="left">Register: CONFIG @ 0x2007</div>
</th>
<tr bgcolor="white">
<td width="20%"><b><tt>FOSC</tt></b></td>
<td><b>Oscillator Selection bits</b></td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>EXTRCCLK</tt></td>
<td>RC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>EXTRCIO</tt></td>
<td>RC oscillator: I/O function on RA6/OSC2/CLKOUT pin, Resistor and Capacitor on RA7/OSC1/CLKIN</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>INTOSCCLK</tt></td>
<td>INTOSC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>INTOSCIO</tt></td>
<td>INTOSC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>ECIO</tt></td>
<td>EC: I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>HS</tt></td>
<td>HS oscillator: High-speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>XT</tt></td>
<td>XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>LP</tt></td>
<td>LP oscillator: Low-power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN</td>
</tr>
<tr bgcolor="white">
<td width="20%"><b><tt>WDTE</tt></b></td>
<td><b>Watchdog Timer Enable bit</b></td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>ON</tt></td>
<td>WDT enabled</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>OFF</tt></td>
<td>WDT disabled</td>
</tr>
<tr bgcolor="white">
<td width="20%"><b><tt>PWRTE</tt></b></td>
<td><b>Power-up Timer Enable bit</b></td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>OFF</tt></td>
<td>PWRT disabled</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>ON</tt></td>
<td>PWRT enabled</td>
</tr>
<tr bgcolor="white">
<td width="20%"><b><tt>MCLRE</tt></b></td>
<td><b>RA5/MCLR/VPP Pin Function Select bit</b></td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>ON</tt></td>
<td>RA5/MCLR/VPP pin function is MCLR</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>OFF</tt></td>
<td>RA5/MCLR/VPP pin function is digital input, MCLR internally tied to VDD</td>
</tr>
<tr bgcolor="white">
<td width="20%"><b><tt>BOREN</tt></b></td>
<td><b>Brown-out Detect Enable bit</b></td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>ON</tt></td>
<td>BOD enabled</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>OFF</tt></td>
<td>BOD disabled</td>
</tr>
<tr bgcolor="white">
<td width="20%"><b><tt>LVP</tt></b></td>
<td><b>Low-Voltage Programming Enable bit</b></td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>ON</tt></td>
<td>RB4/PGM pin has PGM function, low-voltage programming enabled</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>OFF</tt></td>
<td>RB4/PGM pin has digital I/O function, HV on MCLR must be used for programming</td>
</tr>
<tr bgcolor="white">
<td width="20%"><b><tt>CPD</tt></b></td>
<td><b>Data EE Memory Code Protection bit</b></td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>OFF</tt></td>
<td>Data memory code protection off</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>ON</tt></td>
<td>Data memory code-protected</td>
</tr>
<tr bgcolor="white">
<td width="20%"><b><tt>CP</tt></b></td>
<td><b>Flash Program Memory Code Protection bit</b></td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>OFF</tt></td>
<td>Code protection off</td>
</tr>
<tr bgcolor="white">
<td width="20%"><tt>ON</tt></td>
<td>0000h to 07FFh code-protected</td>
</tr>
</tbody></table>
<table bgcolor="lightgray" width="100%" cellpadding="2">
<tbody>
<th colspan="2">
<div align="left">Register: IDLOC0 @ 0x2000</div>
</th>
</tbody></table>
<table bgcolor="lightgray" width="100%" cellpadding="2">
<tbody>
<th colspan="2">
<div align="left">Register: IDLOC1 @ 0x2001</div>
</th>
</tbody></table>
<table bgcolor="lightgray" width="100%" cellpadding="2">
<tbody>
<th colspan="2">
<div align="left">Register: IDLOC2 @ 0x2002</div>
</th>
</tbody></table>
<table bgcolor="lightgray" width="100%" cellpadding="2">
<tbody>
<th colspan="2">
<div align="left">Register: IDLOC3 @ 0x2003</div>
</th>
</tbody></table>
<br/>
</BODY>
</HTML>