Netcruzer Library API  V2.03
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
brd_sbc66ual-r1.h
Go to the documentation of this file.
1 
36 #ifndef SBC66UAL_R1_H
37 #define SBC66UAL_R1_H
38 
39 #if defined(BRD_SBC66UAL_R1)
40 
45 #if defined(THIS_IS_MAIN_FILE)
46  #if defined(__PIC24FJ128GB106__)
47 
48  #if !defined(CONFIGURATION_FUSES_SET)
49  #define CONFIGURATION_FUSES_SET
50 
51  //Are not defined in p24FJ128GB106
52  #ifndef DEBUG_ON
53  #define DEBUG_ON 0x77FF
54  #endif
55  #ifndef DEBUG_OFF
56  #define DEBUG_OFF 0x7FFF
57  #endif
58 
59  // - JTAG Port Disabled (JTAGEN_OFF)
60  // - General Segment Code Protect = Code protection is enabled (GCP_OFF)
61  // - General Segment Write Protect Disabled (GWRP_OFF)
62  // - Emulator functions are shared with PGEC2/PGED2 (ICS_PGx2)
63  //Watchdog timer can be enabled in software via SWDTEN bit. Resets every 8 seconds
64  // - Watchdog Timer Disabled (FWDTEN_OFF)
65  // - WDT Prescaler = 32 (FWPSA_PR32)
66  // - Watchdog Timer Postscaler = 1:32,768 (WDTPS_PS32768)
67  _CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF & ICS_PGx2 & FWDTEN_OFF & FWPSA_PR32 & WDTPS_PS8192)
68  //_CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF & ICS_PGx2 & FWDTEN_OFF & FWPSA_PR32 & WDTPS_PS4096)
69 
70  // - Two Speed Start-up = off (IESO_OFF)
71  // - 96MHz PLL Prescaler = Divide by 4, for 16MHz input (PLLDIV_DIV4)
72  // - Disable 96MHz PLL = not disabled, don't add anthing to _CONFIG2
73  // - Oscillator Selection = Primary oscillator (XT, HS, EC) w/ PLL (FNOSC_PRIPLL)
74  // - Clock switching and clock monitor = Both disabled (FCKSM_CSDCMD)
75  // - OSCO/RC15 function = OSCO or Fosc/2 (OSCIOFNC_OFF)
76  // - RP Register Protection = Unlimited Writes To RP Registers (IOL1WAY_OFF)
77  // - Disable Internal USB Voltage Regulator = Disabled (DISUVREG_OFF)
78  // - Oscillator Selection = HS oscillator (POSCMOD_HS)
79  _CONFIG2( IESO_OFF & PLLDIV_DIV4 & FNOSC_PRIPLL & FCKSM_CSDCMD & OSCIOFNC_OFF & IOL1WAY_OFF & DISUVREG_OFF & POSCMOD_HS)
80 
81  // - Last page(at the top of program memory) and Flash configuration words are not protected (WPCFG_WPCFGDIS)
82  // - Segment Write Protection = Segmented code protection disabled (WPDIS_WPDIS)
83  _CONFIG3(WPCFG_WPCFGDIS & WPDIS_WPDIS) //Disable erase/write protect of all memory regions.
84  #endif
85  #else
86  #error "Not configured for valid CPU"
87  #endif
88 #endif // Prevent more than one set of config fuse definitions
89 
90 //System clock = Fosc. Instruction clock = Fcy = Fosc/2 (in datasheet)
91 #if !defined(CLOCK_FREQ)
92  #define CLOCK_FREQ (32000000ul)
93  #define GetSystemClock() (32000000ul) // Hz
94  #define GetInstructionClock() (GetSystemClock()/2)
95  #define GetPeripheralClock() (GetSystemClock()/2)
96 #endif
97 
98 
99 
100 // *********************************************************************
101 // ----------- Daughter Board Connector Defines for SBC66ZL ------------
102 // *********************************************************************
103 #define PORT_ID_MAX 41 //ID of highest used port ID
104 
105 #define UCPORT_00 B0
106 #define UCPORT_ID_00 UCPORT_ID_B0
107 #define PIN_00 _RB0
108 #define PIN_00_BITADR ((volatile WORD)(/*Bit0=0x0nnn*/0x02CA/*PORTB=0x02CA*/ ))
109 #define LAT_00 _LATB0
110 #define LAT_00_BITADR ((volatile WORD)(/*Bit0=0x0nnn*/0x02CC/*LATB=0x02CC*/ ))
111 #define DIR_00 _TRISB0
112 #define TRIS_00_BITADR ((volatile WORD)(/*Bit0=0x0nnn*/0x02C8/*TRISB=0x02C8*/ ))
113 #define PULLUP_00 _CN2PUE
114 #define PULLDOWN_00 _CN2PDE
115 #define PPS_OUT_00 _RP0R
116 #define PPS_IN_00 0
117 
118 #define UCPORT_01 B1
119 #define UCPORT_ID_01 UCPORT_ID_B1
120 #define PIN_01 _RB1
121 #define PIN_01_BITADR ((volatile WORD)(/*Bit1=0x1nnn*/0x12CA/*PORTB=0x02CA*/ ))
122 #define LAT_01 _LATB1
123 #define LAT_01_BITADR ((volatile WORD)(/*Bit1=0x1nnn*/0x12CC/*LATB=0x02CC*/ ))
124 #define DIR_01 _TRISB1
125 #define TRIS_01_BITADR ((volatile WORD)(/*Bit1=0x1nnn*/0x12C8/*TRISB=0x02C8*/ ))
126 #define PULLUP_01 _CN3PUE
127 #define PULLDOWN_01 _CN3PDE
128 #define PPS_OUT_01 _RP1R
129 #define PPS_IN_01 1
130 
131 #define UCPORT_02 B2
132 #define UCPORT_ID_02 UCPORT_ID_B2
133 #define PIN_02 _RB2
134 #define PIN_02_BITADR ((volatile WORD)(/*Bit2=0x2nnn*/0x22CA/*PORTB=0x02CA*/ ))
135 #define LAT_02 _LATB2
136 #define LAT_02_BITADR ((volatile WORD)(/*Bit2=0x2nnn*/0x22CC/*LATB=0x02CC*/ ))
137 #define DIR_02 _TRISB2
138 #define TRIS_02_BITADR ((volatile WORD)(/*Bit2=0x2nnn*/0x22C8/*TRISB=0x02C8*/ ))
139 #define PULLUP_02 _CN4PUE
140 #define PULLDOWN_02 _CN4PDE
141 #define PPS_OUT_02 _RP13R
142 #define PPS_IN_02 13
143 
144 #define UCPORT_03 B3
145 #define UCPORT_ID_03 UCPORT_ID_B3
146 #define PIN_03 _RB3
147 #define PIN_03_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32CA/*PORTB=0x02CA*/ ))
148 #define LAT_03 _LATB3
149 #define LAT_03_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32CC/*LATB=0x02CC*/ ))
150 #define DIR_03 _TRISB3
151 #define TRIS_03_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32C8/*TRISB=0x02C8*/ ))
152 #define PULLUP_03 _CN5PUE
153 #define PULLDOWN_03 _CN5PDE
154 
155 #define UCPORT_04 B4
156 #define UCPORT_ID_04 UCPORT_ID_B4
157 #define PIN_04 _RB4
158 #define PIN_04_BITADR ((volatile WORD)(/*Bit4=0x4nnn*/0x42CA/*PORTB=0x02CA*/ ))
159 #define LAT_04 _LATB4
160 #define LAT_04_BITADR ((volatile WORD)(/*Bit4=0x4nnn*/0x42CC/*LATB=0x02CC*/ ))
161 #define DIR_04 _TRISB4
162 #define TRIS_04_BITADR ((volatile WORD)(/*Bit4=0x4nnn*/0x42C8/*TRISB=0x02C8*/ ))
163 #define PULLUP_04 _CN6PUE
164 #define PULLDOWN_04 _CN6PDE
165 #define PPS_OUT_04 _RP28R
166 #define PPS_IN_04 28
167 
168 #define UCPORT_05 B5
169 #define UCPORT_ID_05 UCPORT_ID_B5
170 #define PIN_05 _RB5
171 #define PIN_05_BITADR ((volatile WORD)(/*Bit5=0x5nnn*/0x52CA/*PORTB=0x02CA*/ ))
172 #define LAT_05 _LATB5
173 #define LAT_05_BITADR ((volatile WORD)(/*Bit5=0x5nnn*/0x52CC/*LATB=0x02CC*/ ))
174 #define DIR_05 _TRISB5
175 #define TRIS_05_BITADR ((volatile WORD)(/*Bit5=0x5nnn*/0x52C8/*TRISB=0x02C8*/ ))
176 #define PULLUP_05 _CN7PUE
177 #define PULLDOWN_05 _CN7PDE
178 #define PPS_OUT_05 _RP18R
179 #define PPS_IN_05 18
180 
181 #define UCPORT_06 G6
182 #define UCPORT_ID_06 UCPORT_ID_G6
183 #define PIN_06 _RG6
184 #define PIN_06_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62F2/*PORTG=0x02F2*/ ))
185 #define LAT_06 _LATG6
186 #define LAT_06_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62F4/*LATG=0x02F4*/ ))
187 #define DIR_06 _TRISG6
188 #define TRIS_06_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62F0/*TRISG=0x02F0*/ ))
189 #define PULLUP_06 _CN8PUE
190 #define PULLDOWN_06 _CN8PDE
191 #define PPS_OUT_06 _RP21R
192 #define PPS_IN_06 21
193 
194 #define UCPORT_07 G7
195 #define UCPORT_ID_07 UCPORT_ID_G7
196 #define PIN_07 _RG7
197 #define PIN_07_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72F2/*PORTG=0x02F2*/ ))
198 #define LAT_07 _LATG7
199 #define LAT_07_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72F4/*LATG=0x02F4*/ ))
200 #define DIR_07 _TRISG7
201 #define TRIS_07_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72F0/*TRISG=0x02F0*/ ))
202 #define PULLUP_07 _CN9PUE
203 #define PULLDOWN_07 _CN9PDE
204 #define PPS_OUT_07 _RP26R
205 #define PPS_IN_07 26
206 
207 #define UCPORT_08 G8
208 #define UCPORT_ID_08 UCPORT_ID_G8
209 #define PIN_08 _RG8
210 #define PIN_08_BITADR ((volatile WORD)(/*Bit8=0x8nnn*/0x82F2/*PORTG=0x02F2*/ ))
211 #define LAT_08 _LATG8
212 #define LAT_08_BITADR ((volatile WORD)(/*Bit8=0x8nnn*/0x82F4/*LATG=0x02F4*/ ))
213 #define DIR_08 _TRISG8
214 #define TRIS_08_BITADR ((volatile WORD)(/*Bit8=0x8nnn*/0x82F0/*TRISG=0x02F0*/ ))
215 #define PULLUP_08 _CN10PUE
216 #define PULLDOWN_08 _CN10PDE
217 #define PPS_OUT_08 _RP19R
218 #define PPS_IN_08 19
219 
220 #define UCPORT_09 G9
221 #define UCPORT_ID_09 UCPORT_ID_G9
222 #define PIN_09 _RG9
223 #define PIN_09_BITADR ((volatile WORD)(/*Bit9=0x9nnn*/0x92F2/*PORTG=0x02F2*/ ))
224 #define LAT_09 _LATG9
225 #define LAT_09_BITADR ((volatile WORD)(/*Bit9=0x9nnn*/0x92F4/*LATG=0x02F4*/ ))
226 #define DIR_09 _TRISG9
227 #define TRIS_09_BITADR ((volatile WORD)(/*Bit9=0x9nnn*/0x92F0/*TRISG=0x02F0*/ ))
228 #define PULLUP_09 _CN11PUE
229 #define PULLDOWN_09 _CN11PDE
230 #define PPS_OUT_09 _RP27R
231 #define PPS_IN_09 27
232 
233 #define UCPORT_10 E2
234 #define UCPORT_ID_10 UCPORT_ID_E2
235 #define PIN_10 _RE2
236 #define PIN_10_BITADR ((volatile WORD)(/*Bit2=0x2nnn*/0x22E2/*PORTE=0x02E2*/ ))
237 #define LAT_10 _LATE2
238 #define LAT_10_BITADR ((volatile WORD)(/*Bit2=0x2nnn*/0x22E4/*LATE=0x02E4*/ ))
239 #define DIR_10 _TRISE2
240 #define TRIS_10_BITADR ((volatile WORD)(/*Bit2=0x2nnn*/0x22E0/*TRISE=0x02E0*/ ))
241 #define PULLUP_10 _CN60PUE
242 #define PULLDOWN_10 _CN60PDE
243 
244 #define UCPORT_11 E3
245 #define UCPORT_ID_11 UCPORT_ID_E3
246 #define PIN_11 _RE3
247 #define PIN_11_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32E2/*PORTE=0x02E2*/ ))
248 #define LAT_11 _LATE3
249 #define LAT_11_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32E4/*LATE=0x02E4*/ ))
250 #define DIR_11 _TRISE3
251 #define TRIS_11_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32E0/*TRISE=0x02E0*/ ))
252 #define PULLUP_11 _CN61PUE
253 #define PULLDOWN_11 _CN61PDE
254 
255 #define UCPORT_12 D9
256 #define UCPORT_ID_12 UCPORT_ID_D9
257 #define PIN_12 _RD9
258 #define PIN_12_BITADR ((volatile WORD)(/*Bit9=0x9nnn*/0x92DA/*PORTD=0x02DA*/ ))
259 #define LAT_12 _LATD9
260 #define LAT_12_BITADR ((volatile WORD)(/*Bit9=0x9nnn*/0x92DC/*LATD=0x02DC*/ ))
261 #define DIR_12 _TRISD9
262 #define TRIS_12_BITADR ((volatile WORD)(/*Bit9=0x9nnn*/0x92D8/*TRISD=0x02D8*/ ))
263 #define PULLUP_12 _CN54PUE
264 #define PULLDOWN_12 _CN54PDE
265 #define PPS_OUT_12 _RP4R
266 #define PPS_IN_12 4
267 
268 #define UCPORT_13 D10
269 #define UCPORT_ID_13 UCPORT_ID_D10
270 #define PIN_13 _RD10
271 #define PIN_13_BITADR ((volatile WORD)(/*Bit10=0xAnnn*/0xA2DA/*PORTD=0x02DA*/ ))
272 #define LAT_13 _LATD10
273 #define LAT_13_BITADR ((volatile WORD)(/*Bit10=0xAnnn*/0xA2DC/*LATD=0x02DC*/ ))
274 #define DIR_13 _TRISD10
275 #define TRIS_13_BITADR ((volatile WORD)(/*Bit10=0xAnnn*/0xA2D8/*TRISD=0x02D8*/ ))
276 #define PULLUP_13 _CN55PUE
277 #define PULLDOWN_13 _CN55PDE
278 #define PPS_OUT_13 _RP3R
279 #define PPS_IN_13 3
280 
281 //#define UCPORT_14 0 //Dont define is not available!
282 #define UCPORT_ID_14 UCPORT_ID_NA
283 #define PIN_14_BITADR BITADR_NA
284 #define LAT_14_BITADR BITADR_NA
285 #define TRIS_14_BITADR BITADR_NA
286 
287 //#define UCPORT_15 0 //Dont define is not available!
288 #define UCPORT_ID_15 UCPORT_ID_NA
289 #define PIN_15_BITADR BITADR_NA
290 #define LAT_15_BITADR BITADR_NA
291 #define TRIS_15_BITADR BITADR_NA
292 
293 //#define UCPORT_16 0 //Dont define is not available!
294 #define UCPORT_ID_16 UCPORT_ID_NA
295 #define PIN_16_BITADR BITADR_NA
296 #define LAT_16_BITADR BITADR_NA
297 #define TRIS_16_BITADR BITADR_NA
298 
299 //#define UCPORT_17 0 //Dont define is not available!
300 #define UCPORT_ID_17 UCPORT_ID_NA
301 #define PIN_17_BITADR BITADR_NA
302 #define LAT_17_BITADR BITADR_NA
303 #define TRIS_17_BITADR BITADR_NA
304 
305 //#define UCPORT_18 0 //Dont define is not available!
306 #define UCPORT_ID_18 UCPORT_ID_NA
307 #define PIN_18_BITADR BITADR_NA
308 #define LAT_18_BITADR BITADR_NA
309 #define TRIS_18_BITADR BITADR_NA
310 
311 //#define UCPORT_19 0 //Dont define is not available!
312 #define UCPORT_ID_19 UCPORT_ID_NA
313 #define PIN_19_BITADR BITADR_NA
314 #define LAT_19_BITADR BITADR_NA
315 #define TRIS_19_BITADR BITADR_NA
316 
317 #define UCPORT_20 B6
318 #define UCPORT_ID_20 UCPORT_ID_B6
319 #define PIN_20 _RB6
320 #define PIN_20_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62CA/*PORTB=0x02CA*/ ))
321 #define LAT_20 _LATB6
322 #define LAT_20_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62CC/*LATB=0x02CC*/ ))
323 #define DIR_20 _TRISB6
324 #define TRIS_20_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62C8/*TRISB=0x02C8*/ ))
325 #define PULLUP_20 _CN24PUE
326 #define PULLDOWN_20 _CN24PDE
327 #define PPS_OUT_20 _RP6R
328 #define PPS_IN_20 6
329 
330 #define UCPORT_21 B7
331 #define UCPORT_ID_21 UCPORT_ID_B7
332 #define PIN_21 _RB7
333 #define PIN_21_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72CA/*PORTB=0x02CA*/ ))
334 #define LAT_21 _LATB7
335 #define LAT_21_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72CC/*LATB=0x02CC*/ ))
336 #define DIR_21 _TRISB7
337 #define TRIS_21_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72C8/*TRISB=0x02C8*/ ))
338 #define PULLUP_21 _CN25PUE
339 #define PULLDOWN_21 _CN25PDE
340 #define PPS_OUT_21 _RP7R
341 #define PPS_IN_21 7
342 
343 //Port 22 can be MCLR (RST) or E4
344 #define UCPORT_22 E4
345 #define UCPORT_ID_22 UCPORT_ID_E4
346 #define PIN_22 _RE4
347 #define PIN_22_BITADR ((volatile WORD)(/*Bit4=0x4nnn*/0x42E2/*PORTE=0x02E2*/ ))
348 #define LAT_22 _LATE4
349 #define LAT_22_BITADR ((volatile WORD)(/*Bit4=0x4nnn*/0x42E4/*LATE=0x02E4*/ ))
350 #define DIR_22 _TRISE4
351 #define TRIS_22_BITADR ((volatile WORD)(/*Bit4=0x4nnn*/0x42E0/*TRISE=0x02E0*/ ))
352 #define PULLUP_22 _CN62PUE
353 #define PULLDOWN_22 _CN62PDE
354 
355 #define UCPORT_23 E5
356 #define UCPORT_ID_23 UCPORT_ID_E5
357 #define PIN_23 _RE5
358 #define PIN_23_BITADR ((volatile WORD)(/*Bit5=0x5nnn*/0x52E2/*PORTE=0x02E2*/ ))
359 #define LAT_23 _LATE5
360 #define LAT_23_BITADR ((volatile WORD)(/*Bit5=0x5nnn*/0x52E4/*LATE=0x02E4*/ ))
361 #define DIR_23 _TRISE5
362 #define TRIS_23_BITADR ((volatile WORD)(/*Bit5=0x5nnn*/0x52E0/*TRISE=0x02E0*/ ))
363 #define PULLUP_23 _CN63PUE
364 #define PULLDOWN_23 _CN63PDE
365 
366 #define UCPORT_ID_24 UCPORT_ID_E6
367 #define PIN_24 _RE6
368 #define PIN_24_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62E2/*PORTE=0x02E2*/ ))
369 #define LAT_24 _LATE6
370 #define LAT_24_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62E4/*LATE=0x02E4*/ ))
371 #define DIR_24 _TRISE6
372 #define TRIS_24_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62E0/*TRISE=0x02E0*/ ))
373 #define PULLUP_24 _CN64PUE
374 #define PULLDOWN_24 _CN64PDE
375 
376 #define UCPORT_ID_25 UCPORT_ID_E7
377 #define PIN_25 _RE7
378 #define PIN_25_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72E2/*PORTE=0x02E2*/ ))
379 #define LAT_25 _LATE7
380 #define LAT_25_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72E4/*LATE=0x02E4*/ ))
381 #define DIR_25 _TRISE7
382 #define TRIS_25_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72E0/*LAT0=0x02E0*/ ))
383 #define PULLUP_25 _CN65PUE
384 #define PULLDOWN_25 _CN65PDE
385 
386 #define UCPORT_26 F1
387 #define UCPORT_ID_26 UCPORT_ID_F1
388 #define PIN_26 _RF1
389 #define PIN_26_BITADR ((volatile WORD)(/*Bit1=0x1nnn*/0x12EA/*PORTF=0x02EA*/ ))
390 #define LAT_26 _LATF1
391 #define LAT_26_BITADR ((volatile WORD)(/*Bit1=0x1nnn*/0x12EC/*LATF=0x02EC*/ ))
392 #define DIR_26 _TRISF1
393 #define TRIS_26_BITADR ((volatile WORD)(/*Bit1=0x1nnn*/0x12E8/*TRISF=0x02E8*/ ))
394 #define PULLUP_26 _CN69PUE
395 #define PULLDOWN_26 _CN69PDE
396 
397 #define UCPORT_27 F3
398 #define UCPORT_ID_27 UCPORT_ID_F3
399 #define PIN_27 _RF3
400 #define PIN_27_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32EA/*PORTF=0x02EA*/ ))
401 #define LAT_27 _LATF3
402 #define LAT_27_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32EC/*LATF=0x02EC*/ ))
403 #define DIR_27 _TRISF3
404 #define TRIS_27_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32E8/*TRIS=0x02E8*/ ))
405 #define PULLUP_27 _CN71PUE
406 #define PULLDOWN_27 _CN71PDE
407 #define PPS_OUT_27 _RP16R
408 #define PPS_IN_27 16
409 
410 #define UCPORT_28 F4
411 #define UCPORT_ID_28 UCPORT_ID_F4
412 #define PIN_28 _RF4
413 #define PIN_28_BITADR ((volatile WORD)(/*Bit4=0x4nnn*/0x42EA/*PORTF=0x02EA*/ ))
414 #define LAT_28 _LATF4
415 #define LAT_28_BITADR ((volatile WORD)(/*Bit4=0x4nnn*/0x42EC/*LATF=0x02EC*/ ))
416 #define DIR_28 _TRISF4
417 #define TRIS_28_BITADR ((volatile WORD)(/*Bit4=0x4nnn*/0x42E8/*TRISF=0x02E8*/ ))
418 #define PULLUP_28 _CN17PUE
419 #define PULLDOWN_28 _CN17PDE
420 #define PPS_OUT_28 _RP10R
421 #define PPS_IN_28 10
422 
423 #define UCPORT_29 F5
424 #define UCPORT_ID_29 UCPORT_ID_F5
425 #define PIN_29 _RF5
426 #define PIN_29_BITADR ((volatile WORD)(/*Bit5=0x5nnn*/0x52EA/*PORTF=0x02EA*/ ))
427 #define LAT_29 _LATF5
428 #define LAT_29_BITADR ((volatile WORD)(/*Bit5=0x5nnn*/0x52EC/*LATF=0x02EC*/ ))
429 #define DIR_29 _TRISF5
430 #define TRIS_29_BITADR ((volatile WORD)(/*Bit5=0x5nnn*/0x52E8/*TRISF=0x02E8*/ ))
431 #define PULLUP_29 _CN18PUE
432 #define PULLDOWN_29 _CN18PDE
433 #define PPS_OUT_26 _RP2R
434 #define PPS_IN_29 2
435 
436 #define UCPORT_30 B8
437 #define UCPORT_ID_30 UCPORT_ID_B8
438 #define PIN_30 _RB8
439 #define PIN_30_BITADR ((volatile WORD)(/*Bit8=0x8nnn*/0x82CA/*PORTB=0x02CA*/ ))
440 #define LAT_30 _LATB8
441 #define LAT_30_BITADR ((volatile WORD)(/*Bit8=0x8nnn*/0x82CC/*LATB=0x02CC*/ ))
442 #define DIR_30 _TRISB8
443 #define TRIS_30_BITADR ((volatile WORD)(/*Bit8=0x8nnn*/0x82C8/*TRISB=0x02C8*/ ))
444 #define PULLUP_30 _CN26PUE
445 #define PULLDOWN_30 _CN26PDE
446 #define PPS_OUT_30 _RP8R
447 #define PPS_IN_30 8
448 
449 #define UCPORT_31 B9
450 #define UCPORT_ID_31 UCPORT_ID_B9
451 #define PIN_31 _RB9
452 #define PIN_31_BITADR ((volatile WORD)(/*Bit9=0x9nnn*/0x92CA/*PORTB=0x02CA*/ ))
453 #define LAT_31 _LATB9
454 #define LAT_31_BITADR ((volatile WORD)(/*Bit9=0x9nnn*/0x92CC/*LATB=0x02CC*/ ))
455 #define DIR_31 _TRISB9
456 #define TRIS_31_BITADR ((volatile WORD)(/*Bit9=0x9nnn*/0x92C8/*TRISB=0x02C8*/ ))
457 #define PULLUP_31 _CN27PUE
458 #define PULLDOWN_31 _CN27PDE
459 #define PPS_OUT_31 _RP9R
460 #define PPS_IN_31 9
461 
462 #define UCPORT_32 B10
463 #define UCPORT_ID_32 UCPORT_ID_B10
464 #define PIN_32 _RB10
465 #define PIN_32_BITADR ((volatile WORD)(/*Bit10=0xAnnn*/0xA2CA/*PORTB=0x02CA*/ ))
466 #define LAT_32 _LATB10
467 #define LAT_32_BITADR ((volatile WORD)(/*Bit10=0xAnnn*/0xA2CC/*LATB=0x02CC*/ ))
468 #define DIR_32 _TRISB10
469 #define TRIS_32_BITADR ((volatile WORD)(/*Bit10=0xAnnn*/0xA2C8/*TRISB=0x02C8*/ ))
470 #define PULLUP_32 _CN28PUE
471 #define PULLDOWN_32 _CN28PDE
472 
473 #define UCPORT_33 B11
474 #define UCPORT_ID_33 UCPORT_ID_B11
475 #define PIN_33 _RB11
476 #define PIN_33_BITADR ((volatile WORD)(/*Bit11=0xBnnn*/0xB2CA/*PORTB=0x02CA*/ ))
477 #define LAT_33 _LATB11
478 #define LAT_33_BITADR ((volatile WORD)(/*Bit11=0xBnnn*/0xB2CC/*LATB=0x02CC*/ ))
479 #define DIR_33 _TRISB11
480 #define TRIS_33_BITADR ((volatile WORD)(/*Bit11=0xBnnn*/0xB2C8/*TRISB=0x02C8*/ ))
481 #define PULLUP_33 _CN29PUE
482 #define PULLDOWN_33 _CN29PDE
483 
484 #define UCPORT_34 B12
485 #define UCPORT_ID_34 UCPORT_ID_B14
486 #define PIN_34 _RB14
487 #define PIN_34_BITADR ((volatile WORD)(/*Bit14=0xEnnn*/0xE2CA/*PORTB=0x02CA*/ ))
488 #define LAT_34 _LATB14
489 #define LAT_34_BITADR ((volatile WORD)(/*Bit14=0xEnnn*/0xE2CC/*LATB=0x02CC*/ ))
490 #define DIR_34 _TRISB14
491 #define TRIS_34_BITADR ((volatile WORD)(/*Bit14=0xEnnn*/0xE2C8/*TRISB=0x02C8*/ ))
492 #define PULLUP_34 _CN32PUE
493 #define PULLDOWN_34 _CN32PDE
494 #define PPS_OUT_34 _RP14R
495 #define PPS_IN_34 14
496 
497 #define UCPORT_35 B15
498 #define UCPORT_ID_35 UCPORT_ID_B15
499 #define PIN_35 _RB15
500 #define PIN_35_BITADR ((volatile WORD)(/*Bit15=0xFnnn*/0xF2CA/*PORTB=0x02CA*/ ))
501 #define LAT_35 _LATB15
502 #define LAT_35_BITADR ((volatile WORD)(/*Bit15=0xFnnn*/0xF2CC/*LATB=0x02CC*/ ))
503 #define DIR_35 _TRISB15
504 #define TRIS_35_BITADR ((volatile WORD)(/*Bit15=0xFnnn*/0xF2C8/*TRISB=0x02C8*/ ))
505 #define PULLUP_35 _CN12PUE
506 #define PULLDOWN_35 _CN12PDE
507 #define PPS_OUT_35 _RP29R
508 #define PPS_IN_35 29
509 
510 #define UCPORT_36 D0
511 #define UCPORT_ID_36 UCPORT_ID_D0
512 #define PIN_36 _RD0
513 #define PIN_36_BITADR ((volatile WORD)(/*Bit0=0x0nnn*/0x02DA/*PORTD=0x02DA*/ ))
514 #define LAT_36 _LATD0
515 #define LAT_36_BITADR ((volatile WORD)(/*Bit0=0x0nnn*/0x02DC/*LATD=0x02DC*/ ))
516 #define DIR_36 _TRISD0
517 #define TRIS_36_BITADR ((volatile WORD)(/*Bit0=0x0nnn*/0x02D8/*TRISD=0x02D8*/ ))
518 #define PULLUP_36 _CN49PUE
519 #define PULLDOWN_36 _CN49PDE
520 #define PPS_OUT_36 _RP11R
521 #define PPS_IN_36 11
522 
523 #define UCPORT_37 D1
524 #define UCPORT_ID_37 UCPORT_ID_D1
525 #define PIN_37 _RD1
526 #define PIN_37_BITADR ((volatile WORD)(/*Bit1=0x1nnn*/0x12DA/*PORTD=0x02DA*/ ))
527 #define LAT_37 _LATD1
528 #define LAT_37_BITADR ((volatile WORD)(/*Bit1=0x1nnn*/0x12DC/*LATD=0x02DC*/ ))
529 #define DIR_37 _TRISD1
530 #define TRIS_37_BITADR ((volatile WORD)(/*Bit1=0x1nnn*/0x12D8/*TRISD=0x02D8*/ ))
531 #define PULLUP_37 _CN50PUE
532 #define PULLDOWN_37 _CN50PDE
533 #define PPS_OUT_37 _RP24R
534 #define PPS_IN_37 24
535 
536 #define UCPORT_38 D2
537 #define UCPORT_ID_38 UCPORT_ID_D2
538 #define PIN_38 _RD2
539 #define PIN_38_BITADR ((volatile WORD)(/*Bit2=0x2nnn*/0x22DA/*PORTD=0x02DA*/ ))
540 #define LAT_38 _LATD2
541 #define LAT_38_BITADR ((volatile WORD)(/*Bit2=0x2nnn*/0x22DC/*LATD=0x02DC*/ ))
542 #define DIR_38 _TRISD2
543 #define TRIS_38_BITADR ((volatile WORD)(/*Bit2=0x2nnn*/0x22D8/*TRISD=0x02D8*/ ))
544 #define PULLUP_38 _CN51PUE
545 #define PULLDOWN_38 _CN51PDE
546 #define PPS_OUT_38 _RP23R
547 #define PPS_IN_38 23
548 
549 #define UCPORT_39 D3
550 #define UCPORT_ID_39 UCPORT_ID_D3
551 #define PIN_39 _RD3
552 #define PIN_39_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32DA/*PORTD=0x02DA*/ ))
553 #define LAT_39 _LATD3
554 #define LAT_39_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32DC/*LATD=0x02DC*/ ))
555 #define DIR_39 _TRISD3
556 #define TRIS_39_BITADR ((volatile WORD)(/*Bit3=0x3nnn*/0x32D8/*TRISD=0x02D8*/ ))
557 #define PULLUP_39 _CN52PUE
558 #define PULLDOWN_39 _CN52PDE
559 #define PPS_OUT_39 _RP22R
560 #define PPS_IN_39 22
561 
562 #define UCPORT_40 D6
563 #define UCPORT_ID_40 UCPORT_ID_D6
564 #define PIN_40 _RD6
565 #define PIN_40_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62DA/*PORTD=0x02DA*/ ))
566 #define LAT_40 _LATD6
567 #define LAT_40_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62DC/*LATD=0x02DC*/ ))
568 #define DIR_40 _TRISD6
569 #define TRIS_40_BITADR ((volatile WORD)(/*Bit6=0x6nnn*/0x62D8/*TRISD=0x02D8*/ ))
570 #define PULLUP_40 _CN15PUE
571 #define PULLDOWN_40 _CN15PDE
572 
573 #define UCPORT_41 D7
574 #define UCPORT_ID_41 UCPORT_ID_D7
575 #define PIN_41 _RD7
576 #define PIN_41_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72DA/*PORTD=0x02DA*/ ))
577 #define LAT_41 _LATD7
578 #define LAT_41_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72DC/*LATD=0x02DC*/ ))
579 #define DIR_41 _TRISD7
580 #define TRIS_41_BITADR ((volatile WORD)(/*Bit7=0x7nnn*/0x72D8/*TRISD=0x02D8*/ ))
581 #define PULLUP_41 _CN16PUE
582 #define PULLDOWN_41 _CN16PDE
583 
584 //#define UCPORT_42 0 //Dont define is not available!
585 #define UCPORT_ID_42 UCPORT_ID_NA
586 #define PIN_42_BITADR BITADR_NA
587 #define LAT_42_BITADR BITADR_NA
588 #define TRIS_42_BITADR BITADR_NA
589 
590 //#define UCPORT_43 0 //Dont define is not available!
591 #define UCPORT_ID_43 UCPORT_ID_NA
592 #define PIN_43_BITADR BITADR_NA
593 #define LAT_43_BITADR BITADR_NA
594 #define TRIS_43_BITADR BITADR_NA
595 
596 //#define UCPORT_44 0 //Dont define is not available!
597 #define UCPORT_ID_44 UCPORT_ID_NA
598 #define PIN_44_BITADR BITADR_NA
599 #define LAT_44_BITADR BITADR_NA
600 #define TRIS_44_BITADR BITADR_NA
601 
602 //#define UCPORT_45 0 //Dont define is not available!
603 #define UCPORT_ID_45 UCPORT_ID_NA
604 #define PIN_45_BITADR BITADR_NA
605 #define LAT_45_BITADR BITADR_NA
606 #define TRIS_45_BITADR BITADR_NA
607 
608 
609 //I2C ports
610 #define PORT_ID_SDA1 12
611 #define UCPORT_SDA1 UCPORT_12
612 #define UCPORT_ID_SDA1 UCPORT_ID_12
613 #define PIN_SDA1 PIN_12
614 #define PIN_SDA1_BITADR PIN_12_BITADR
615 #define LAT_SDA1 LAT_12
616 #define LAT_SDA1_BITADR LAT_12_BITADR
617 #define DIR_SDA1 DIR_12
618 #define TRIS_SDA1_BITADR TRIS_12_BITADR
619 #define PULLUP_SDA1 PULLUP_12
620 #define PULLDOWN_SDA1 PULLDOWN_12
621 
622 #define PORT_ID_SCL1 13
623 #define UCPORT_SCL1 UCPORT_13
624 #define UCPORT_ID_SCL1 UCPORT_ID_13
625 #define PIN_SCL1 PIN_13
626 #define PIN_SCL1_BITADR PIN_13_BITADR
627 #define LAT_SCL1 LAT_13
628 #define LAT_SCL1_BITADR LAT_13_BITADR
629 #define DIR_SCL1 DIR_13
630 #define TRIS_SCL1_BITADR TRIS_13_BITADR
631 #define PULLUP_SCL1 PULLUP_13
632 #define PULLDOWN_SCL1 PULLDOWN_13
633 
634 #define PORT_ID_SDA2 28
635 #define UCPORT_SDA2 UCPORT_28
636 #define UCPORT_ID_SDA2 UCPORT_ID_28
637 #define PIN_SDA2 PIN_28
638 #define PIN_SDA2_BITADR PIN_28_BITADR
639 #define LAT_SDA2 LAT_28
640 #define LAT_SDA2_BITADR LAT_28_BITADR
641 #define DIR_SDA2 DIR_28
642 #define TRIS_SDA2_BITADR TRIS_28_BITADR
643 #define PULLUP_SDA2 PULLUP_28
644 #define PULLDOWN_SDA2 PULLDOWN_28
645 
646 #define PORT_ID_SCL2 29
647 #define UCPORT_SCL2 UCPORT_29
648 #define UCPORT_ID_SCL2 UCPORT_ID_29
649 #define PIN_SCL2 PIN_29
650 #define PIN_SCL2_BITADR PIN_29_BITADR
651 #define LAT_SCL2 LAT_29
652 #define LAT_SCL2_BITADR LAT_29_BITADR
653 #define DIR_SCL2 DIR_29
654 #define TRIS_SCL2_BITADR TRIS_29_BITADR
655 #define PULLUP_SCL2 PULLUP_29
656 #define PULLDOWN_SCL2 PULLDOWN_29
657 
658 #define PORT_ID_SDA3 25
659 #define UCPORT_SDA3 UCPORT_25
660 #define UCPORT_ID_SDA3 UCPORT_ID_25
661 #define PIN_SDA3 PIN_25
662 #define PIN_SDA3_BITADR PIN_25_BITADR
663 #define LAT_SDA3 LAT_25
664 #define LAT_SDA3_BITADR LAT_25_BITADR
665 #define DIR_SDA3 DIR_25
666 #define TRIS_SDA3_BITADR TRIS_25_BITADR
667 #define PULLUP_SDA3 PULLUP_25
668 #define PULLDOWN_SDA3 PULLDOWN_25
669 
670 #define PORT_ID_SCL3 24
671 #define UCPORT_SCL3 UCPORT_24
672 #define UCPORT_ID_SCL3 UCPORT_ID_24
673 #define PIN_SCL3 PIN_24
674 #define PIN_SCL3_BITADR PIN_24_BITADR
675 #define LAT_SCL3 LAT_24
676 #define LAT_SCL3_BITADR LAT_24_BITADR
677 #define DIR_SCL3 DIR_24
678 #define TRIS_SCL3_BITADR TRIS_24_BITADR
679 #define PULLUP_SCL3 PULLUP_24
680 #define PULLDOWN_SCL3 PULLDOWN_24
681 
682 
683 
684 // *********************************************************************
685 // ---------------- Analog Netcruzer Port Names --------------------
686 // *********************************************************************
687 #define PIN_A0 PIN_00
688 #define PIN_A0_BITADR PIN_00_BITADR
689 #define LAT_A0 LAT_00
690 #define LAT_A0_BITADR LAT_00_BITADR
691 #define DIR_A0 DIR_00
692 #define TRIS_A0_BITADR TRIS_00_BITADR
693 #define PULLUP_A0 PULLUP_00
694 #define PULLDOWN_A0 PULLDOWN_00
695 
696 #define PIN_A1 PIN_01
697 #define PIN_A1_BITADR PIN_01_BITADR
698 #define LAT_A1 LAT_01
699 #define LAT_A1_BITADR LAT_01_BITADR
700 #define DIR_A1 DIR_01
701 #define TRIS_A1_BITADR TRIS_01_BITADR
702 #define PULLUP_A1 PULLUP_01
703 #define PULLDOWN_A1 PULLDOWN_01
704 
705 #define PIN_A2 PIN_02
706 #define PIN_A2_BITADR PIN_02_BITADR
707 #define LAT_A2 LAT_02
708 #define LAT_A2_BITADR LAT_02_BITADR
709 #define DIR_A2 DIR_02
710 #define TRIS_A2_BITADR TRIS_02_BITADR
711 #define PULLUP_A2 PULLUP_02
712 #define PULLDOWN_A2 PULLDOWN_02
713 
714 #define PIN_A3 PIN_03
715 #define PIN_A3_BITADR PIN_03_BITADR
716 #define LAT_A3 LAT_03
717 #define LAT_A3_BITADR LAT_03_BITADR
718 #define DIR_A3 DIR_03
719 #define TRIS_A3_BITADR TRIS_03_BITADR
720 #define PULLUP_A3 PULLUP_03
721 #define PULLDOWN_A3 PULLDOWN_03
722 
723 #define PIN_A4 PIN_04
724 #define PIN_A4_BITADR PIN_04_BITADR
725 #define LAT_A4 LAT_04
726 #define LAT_A4_BITADR LAT_04_BITADR
727 #define DIR_A4 DIR_04
728 #define TRIS_A4_BITADR TRIS_04_BITADR
729 #define PULLUP_A4 PULLUP_04
730 #define PULLDOWN_A4 PULLDOWN_04
731 
732 #define PIN_A5 PIN_05
733 #define PIN_A5_BITADR PIN_05_BITADR
734 #define LAT_A5 LAT_05
735 #define LAT_A5_BITADR LAT_05_BITADR
736 #define DIR_A5 DIR_05
737 #define TRIS_A5_BITADR TRIS_05_BITADR
738 #define PULLUP_A5 PULLUP_05
739 #define PULLDOWN_A5 PULLDOWN_05
740 
741 #define PIN_A6 PIN_30
742 #define PIN_A6_BITADR PIN_30_BITADR
743 #define LAT_A6 LAT_30
744 #define LAT_A6_BITADR LAT_30_BITADR
745 #define DIR_A6 DIR_30
746 #define TRIS_A6_BITADR TRIS_30_BITADR
747 #define PULLUP_A6 PULLUP_30
748 #define PULLDOWN_A6 PULLDOWN_30
749 
750 #define PIN_A7 PIN_31
751 #define PIN_A7_BITADR PIN_31_BITADR
752 #define LAT_A7 LAT_31
753 #define LAT_A7_BITADR LAT_31_BITADR
754 #define DIR_A7 DIR_31
755 #define TRIS_A7_BITADR TRIS_31_BITADR
756 #define PULLUP_A7 PULLUP_31
757 #define PULLDOWN_A7 PULLDOWN_31
758 
759 #define PIN_A8 PIN_32
760 #define PIN_A8_BITADR PIN_32_BITADR
761 #define LAT_A8 LAT_32
762 #define LAT_A8_BITADR LAT_32_BITADR
763 #define DIR_A8 DIR_32
764 #define TRIS_A8_BITADR TRIS_32_BITADR
765 #define PULLUP_A8 PULLUP_32
766 #define PULLDOWN_A8 PULLDOWN_32
767 
768 #define PIN_A9 PIN_33
769 #define PIN_A9_BITADR PIN_33_BITADR
770 #define LAT_A9 LAT_33
771 #define LAT_A9_BITADR LAT_33_BITADR
772 #define DIR_A9 DIR_33
773 #define TRIS_A9_BITADR TRIS_33_BITADR
774 #define PULLUP_A9 PULLUP_33
775 #define PULLDOWN_A9 PULLDOWN_33
776 
777 #define PIN_A10 PIN_34
778 #define PIN_A10_BITADR PIN_34_BITADR
779 #define LAT_A10 LAT_34
780 #define LAT_A10_BITADR LAT_34_BITADR
781 #define DIR_A10 DIR_34
782 #define TRIS_A10_BITADR TRIS_34_BITADR
783 #define PULLUP_A10 PULLUP_34
784 #define PULLDOWN_A10 PULLDOWN_34
785 
786 #define PIN_A11 PIN_35
787 #define PIN_A11_BITADR PIN_35_BITADR
788 #define LAT_A11 LAT_35
789 #define LAT_A11_BITADR LAT_35_BITADR
790 #define DIR_A11 DIR_35
791 #define TRIS_A11_BITADR TRIS_35_BITADR
792 #define PULLUP_A11 PULLUP_35
793 #define PULLDOWN_A11 PULLDOWN_35
794 
795 
796 
797 // *********************************************************************
798 // ---------------- Old to New Netcruzer Port Names --------------------
799 // *********************************************************************
800 #define UCPORT_SC UCPORT_13
801 #define UCPORT_ID_SC UCPORT_ID_13
802 #define PIN_SC PIN_13
803 #define PIN_SC_BITADR PIN_13_BITADR
804 #define LAT_SC LAT_13
805 #define LAT_SC_BITADR LAT_13_BITADR
806 #define DIR_SC DIR_13
807 #define TRIS_SC_BITADR TRIS_13_BITADR
808 #define PULLUP_SC PULLUP_13
809 #define PULLDOWN_SC PULLDOWN_13
810 #define PPS_OUT_SC PPS_OUT_13
811 #define PPS_IN_SC PPS_IN_13
812 
813 #define UCPORT_SD UCPORT_12
814 #define UCPORT_ID_SD UCPORT_ID_12
815 #define PIN_SD PIN_12
816 #define PIN_SD_BITADR PIN_12_BITADR
817 #define LAT_SD LAT_12
818 #define LAT_SD_BITADR LAT_12_BITADR
819 #define DIR_SD DIR_12
820 #define TRIS_SD_BITADR TRIS_12_BITADR
821 #define PULLUP_SD PULLUP_12
822 #define PULLDOWN_SD PULLDOWN_12
823 #define PPS_OUT_SD PPS_OUT_12
824 #define PPS_IN_SD PPS_IN_12
825 
826 #define UCPORT_S0 UCPORT_24
827 #define UCPORT_ID_S0 UCPORT_ID_24
828 #define PIN_S0 PIN_24
829 #define PIN_S0_BITADR PIN_24_BITADR
830 #define LAT_S0 LAT_24
831 #define LAT_S0_BITADR LAT_24_BITADR
832 #define DIR_S0 DIR_24
833 #define TRIS_S0_BITADR TRIS_24_BITADR
834 #define PULLUP_S0 PULLUP_24
835 #define PULLDOWN_S0 PULLDOWN_24
836 #define PPS_OUT_S0 PPS_OUT_24
837 #define PPS_IN_S0 PPS_IN_24
838 
839 #define UCPORT_S1 UCPORT_25
840 #define UCPORT_ID_S1 UCPORT_ID_25
841 #define PIN_S1 PIN_25
842 #define PIN_S1_BITADR PIN_25_BITADR
843 #define LAT_S1 LAT_25
844 #define LAT_S1_BITADR LAT_25_BITADR
845 #define DIR_S1 DIR_25
846 #define TRIS_S1_BITADR TRIS_25_BITADR
847 #define PULLUP_S1 PULLUP_25
848 #define PULLDOWN_S1 PULLDOWN_25
849 #define PPS_OUT_S1 PPS_OUT_25
850 #define PPS_IN_S1 PPS_IN_25
851 
852 #define UCPORT_T0 UCPORT_20
853 #define UCPORT_ID_T0 UCPORT_ID_20
854 #define PIN_T0 PIN_20
855 #define PIN_T0_BITADR PIN_20_BITADR
856 #define LAT_T0 LAT_20
857 #define LAT_T0_BITADR LAT_20_BITADR
858 #define DIR_T0 DIR_20
859 #define TRIS_T0_BITADR TRIS_20_BITADR
860 #define PULLUP_T0 PULLUP_20
861 #define PULLDOWN_T0 PULLDOWN_20
862 #define PPS_OUT_T0 PPS_OUT_20
863 #define PPS_IN_T0 PPS_IN_20
864 
865 #define UCPORT_T1 UCPORT_21
866 #define UCPORT_ID_T1 UCPORT_ID_21
867 #define PIN_T1 PIN_21
868 #define PIN_T1_BITADR PIN_21_BITADR
869 #define LAT_T1 LAT_21
870 #define LAT_T1_BITADR LAT_21_BITADR
871 #define DIR_T1 DIR_21
872 #define TRIS_T1_BITADR TRIS_21_BITADR
873 #define PULLUP_T1 PULLUP_21
874 #define PULLDOWN_T1 PULLDOWN_21
875 #define PPS_OUT_T1 PPS_OUT_21
876 #define PPS_IN_T1 PPS_IN_21
877 
878 #define UCPORT_T2 UCPORT_22
879 #define UCPORT_ID_T2 UCPORT_ID_22
880 #define PIN_T2 PIN_22
881 #define PIN_T2_BITADR PIN_22_BITADR
882 #define LAT_T2 LAT_22
883 #define LAT_T2_BITADR LAT_22_BITADR
884 #define DIR_T2 DIR_22
885 #define TRIS_T2_BITADR TRIS_22_BITADR
886 #define PULLUP_T2 PULLUP_22
887 #define PULLDOWN_T2 PULLDOWN_22
888 #define PPS_OUT_T2 PPS_OUT_22
889 #define PPS_IN_T2 PPS_IN_22
890 
891 #define UCPORT_T3 UCPORT_23
892 #define UCPORT_ID_T3 UCPORT_ID_23
893 #define PIN_T3 PIN_23
894 #define PIN_T3_BITADR PIN_23_BITADR
895 #define LAT_T3 LAT_23
896 #define LAT_T3_BITADR LAT_23_BITADR
897 #define DIR_T3 DIR_23
898 #define TRIS_T3_BITADR TRIS_23_BITADR
899 #define PULLUP_T3 PULLUP_23
900 #define PULLDOWN_T3 PULLDOWN_23
901 #define PPS_OUT_T3 PPS_OUT_23
902 #define PPS_IN_T3 PPS_IN_23
903 
904 #define UCPORT_T4 UCPORT_26
905 #define UCPORT_ID_T4 UCPORT_ID_26
906 #define PIN_T4 PIN_26
907 #define PIN_T4_BITADR PIN_26_BITADR
908 #define LAT_T4 LAT_26
909 #define LAT_T4_BITADR LAT_26_BITADR
910 #define DIR_T4 DIR_26
911 #define TRIS_T4_BITADR TRIS_26_BITADR
912 #define PULLUP_T4 PULLUP_26
913 #define PULLDOWN_T4 PULLDOWN_26
914 #define PPS_OUT_T4 PPS_OUT_26
915 #define PPS_IN_T4 PPS_IN_26
916 
917 #define UCPORT_T5 UCPORT_27
918 #define UCPORT_ID_T5 UCPORT_ID_27
919 #define PIN_T5 PIN_27
920 #define PIN_T5_BITADR PIN_27_BITADR
921 #define LAT_T5 LAT_27
922 #define LAT_T5_BITADR LAT_27_BITADR
923 #define DIR_T5 DIR_27
924 #define TRIS_T5_BITADR TRIS_27_BITADR
925 #define PULLUP_T5 PULLUP_27
926 #define PULLDOWN_T5 PULLDOWN_27
927 #define PPS_OUT_T5 PPS_OUT_27
928 #define PPS_IN_T5 PPS_IN_27
929 
930 #define UCPORT_T6 UCPORT_28
931 #define UCPORT_ID_T6 UCPORT_ID_28
932 #define PIN_T6 PIN_28
933 #define PIN_T6_BITADR PIN_28_BITADR
934 #define LAT_T6 LAT_28
935 #define LAT_T6_BITADR LAT_28_BITADR
936 #define DIR_T6 DIR_28
937 #define TRIS_T6_BITADR TRIS_28_BITADR
938 #define PULLUP_T6 PULLUP_28
939 #define PULLDOWN_T6 PULLDOWN_28
940 #define PPS_OUT_T6 PPS_OUT_28
941 #define PPS_IN_T6 PPS_IN_28
942 
943 #define UCPORT_T7 UCPORT_29
944 #define UCPORT_ID_T7 UCPORT_ID_29
945 #define PIN_T7 PIN_29
946 #define PIN_T7_BITADR PIN_29_BITADR
947 #define LAT_T7 LAT_29
948 #define LAT_T7_BITADR LAT_29_BITADR
949 #define DIR_T7 DIR_29
950 #define TRIS_T7_BITADR TRIS_29_BITADR
951 #define PULLUP_T7 PULLUP_29
952 #define PULLDOWN_T7 PULLDOWN_29
953 #define PPS_OUT_T7 PPS_OUT_29
954 #define PPS_IN_T7 PPS_IN_29
955 
956 #define UCPORT_X0 UCPORT_00
957 #define UCPORT_ID_X0 UCPORT_ID_00
958 #define PIN_X0 PIN_00
959 #define PIN_X0_BITADR PIN_00_BITADR
960 #define LAT_X0 LAT_00
961 #define LAT_X0_BITADR LAT_00_BITADR
962 #define DIR_X0 DIR_00
963 #define TRIS_X0_BITADR TRIS_00_BITADR
964 #define PULLUP_X0 PULLUP_00
965 #define PULLDOWN_X0 PULLDOWN_00
966 #define PPS_OUT_X0 PPS_OUT_00
967 #define PPS_IN_X0 PPS_IN_00
968 
969 #define UCPORT_X1 UCPORT_01
970 #define UCPORT_ID_X1 UCPORT_ID_01
971 #define PIN_X1 PIN_01
972 #define PIN_X1_BITADR PIN_01_BITADR
973 #define LAT_X1 LAT_01
974 #define LAT_X1_BITADR LAT_01_BITADR
975 #define DIR_X1 DIR_01
976 #define TRIS_X1_BITADR TRIS_01_BITADR
977 #define PULLUP_X1 PULLUP_01
978 #define PULLDOWN_X1 PULLDOWN_01
979 #define PPS_OUT_X1 PPS_OUT_01
980 #define PPS_IN_X1 PPS_IN_01
981 
982 #define UCPORT_X2 UCPORT_02
983 #define UCPORT_ID_X2 UCPORT_ID_02
984 #define PIN_X2 PIN_02
985 #define PIN_X2_BITADR PIN_02_BITADR
986 #define LAT_X2 LAT_02
987 #define LAT_X2_BITADR LAT_02_BITADR
988 #define DIR_X2 DIR_02
989 #define TRIS_X2_BITADR TRIS_02_BITADR
990 #define PULLUP_X2 PULLUP_02
991 #define PULLDOWN_X2 PULLDOWN_02
992 #define PPS_OUT_X2 PPS_OUT_02
993 #define PPS_IN_X2 PPS_IN_02
994 
995 #define UCPORT_X3 UCPORT_03
996 #define UCPORT_ID_X3 UCPORT_ID_03
997 #define PIN_X3 PIN_03
998 #define PIN_X3_BITADR PIN_03_BITADR
999 #define LAT_X3 LAT_03
1000 #define LAT_X3_BITADR LAT_03_BITADR
1001 #define DIR_X3 DIR_03
1002 #define TRIS_X3_BITADR TRIS_03_BITADR
1003 #define PULLUP_X3 PULLUP_03
1004 #define PULLDOWN_X3 PULLDOWN_03
1005 #define PPS_OUT_X3 PPS_OUT_03
1006 #define PPS_IN_X3 PPS_IN_03
1007 
1008 #define UCPORT_X4 UCPORT_04
1009 #define UCPORT_ID_X4 UCPORT_ID_04
1010 #define PIN_X4 PIN_04
1011 #define PIN_X4_BITADR PIN_04_BITADR
1012 #define LAT_X4 LAT_04
1013 #define LAT_X4_BITADR LAT_04_BITADR
1014 #define DIR_X4 DIR_04
1015 #define TRIS_X4_BITADR TRIS_04_BITADR
1016 #define PULLUP_X4 PULLUP_04
1017 #define PULLDOWN_X4 PULLDOWN_04
1018 #define PPS_OUT_X4 PPS_OUT_04
1019 #define PPS_IN_X4 PPS_IN_04
1020 
1021 #define UCPORT_X5 UCPORT_05
1022 #define UCPORT_ID_X5 UCPORT_ID_05
1023 #define PIN_X5 PIN_05
1024 #define PIN_X5_BITADR PIN_05_BITADR
1025 #define LAT_X5 LAT_05
1026 #define LAT_X5_BITADR LAT_05_BITADR
1027 #define DIR_X5 DIR_05
1028 #define TRIS_X5_BITADR TRIS_05_BITADR
1029 #define PULLUP_X5 PULLUP_05
1030 #define PULLDOWN_X5 PULLDOWN_05
1031 #define PPS_OUT_X5 PPS_OUT_05
1032 #define PPS_IN_X5 PPS_IN_05
1033 
1034 #define UCPORT_X6 UCPORT_06
1035 #define UCPORT_ID_X6 UCPORT_ID_06
1036 #define PIN_X6 PIN_06
1037 #define PIN_X6_BITADR PIN_06_BITADR
1038 #define LAT_X6 LAT_06
1039 #define LAT_X6_BITADR LAT_06_BITADR
1040 #define DIR_X6 DIR_06
1041 #define TRIS_X6_BITADR TRIS_06_BITADR
1042 #define PULLUP_X6 PULLUP_06
1043 #define PULLDOWN_X6 PULLDOWN_06
1044 #define PPS_OUT_X6 PPS_OUT_06
1045 #define PPS_IN_X6 PPS_IN_06
1046 
1047 #define UCPORT_X7 UCPORT_07
1048 #define UCPORT_ID_X7 UCPORT_ID_07
1049 #define PIN_X7 PIN_07
1050 #define PIN_X7_BITADR PIN_07_BITADR
1051 #define LAT_X7 LAT_07
1052 #define LAT_X7_BITADR LAT_07_BITADR
1053 #define DIR_X7 DIR_07
1054 #define TRIS_X7_BITADR TRIS_07_BITADR
1055 #define PULLUP_X7 PULLUP_07
1056 #define PULLDOWN_X7 PULLDOWN_07
1057 #define PPS_OUT_X7 PPS_OUT_07
1058 #define PPS_IN_X7 PPS_IN_07
1059 
1060 #define UCPORT_X8 UCPORT_08
1061 #define UCPORT_ID_X8 UCPORT_ID_08
1062 #define PIN_X8 PIN_08
1063 #define PIN_X8_BITADR PIN_08_BITADR
1064 #define LAT_X8 LAT_08
1065 #define LAT_X8_BITADR LAT_08_BITADR
1066 #define DIR_X8 DIR_08
1067 #define TRIS_X8_BITADR TRIS_08_BITADR
1068 #define PULLUP_X8 PULLUP_08
1069 #define PULLDOWN_X8 PULLDOWN_08
1070 #define PPS_OUT_X8 PPS_OUT_08
1071 #define PPS_IN_X8 PPS_IN_08
1072 
1073 #define UCPORT_X9 UCPORT_09
1074 #define UCPORT_ID_X9 UCPORT_ID_09
1075 #define PIN_X9 PIN_09
1076 #define PIN_X9_BITADR PIN_09_BITADR
1077 #define LAT_X9 LAT_09
1078 #define LAT_X9_BITADR LAT_09_BITADR
1079 #define DIR_X9 DIR_09
1080 #define TRIS_X9_BITADR TRIS_09_BITADR
1081 #define PULLUP_X9 PULLUP_09
1082 #define PULLDOWN_X9 PULLDOWN_09
1083 #define PPS_OUT_X9 PPS_OUT_09
1084 #define PPS_IN_X9 PPS_IN_09
1085 
1086 #define UCPORT_X10 UCPORT_10
1087 #define UCPORT_ID_X10 UCPORT_ID_10
1088 #define PIN_X10 PIN_10
1089 #define PIN_X10_BITADR PIN_10_BITADR
1090 #define LAT_X10 LAT_10
1091 #define LAT_X10_BITADR LAT_10_BITADR
1092 #define DIR_X10 DIR_10
1093 #define TRIS_X10_BITADR TRIS_10_BITADR
1094 #define PULLUP_X10 PULLUP_10
1095 #define PULLDOWN_X10 PULLDOWN_10
1096 #define PPS_OUT_X10 PPS_OUT_10
1097 #define PPS_IN_X10 PPS_IN_10
1098 
1099 #define UCPORT_X11 UCPORT_11
1100 #define UCPORT_ID_X11 UCPORT_ID_11
1101 #define PIN_X11 PIN_11
1102 #define PIN_X11_BITADR PIN_11_BITADR
1103 #define LAT_X11 LAT_11
1104 #define LAT_X11_BITADR LAT_11_BITADR
1105 #define DIR_X11 DIR_11
1106 #define TRIS_X11_BITADR TRIS_11_BITADR
1107 #define PULLUP_X11 PULLUP_11
1108 #define PULLDOWN_X11 PULLDOWN_11
1109 #define PPS_OUT_X11 PPS_OUT_11
1110 #define PPS_IN_X11 PPS_IN_11
1111 
1112 #define UCPORT_Y0 UCPORT_30
1113 #define UCPORT_ID_Y0 UCPORT_ID_30
1114 #define PIN_Y0 PIN_30
1115 #define PIN_Y0_BITADR PIN_30_BITADR
1116 #define LAT_Y0 LAT_30
1117 #define LAT_Y0_BITADR LAT_30_BITADR
1118 #define DIR_Y0 DIR_30
1119 #define TRIS_Y0_BITADR TRIS_30_BITADR
1120 #define PULLUP_Y0 PULLUP_30
1121 #define PULLDOWN_Y0 PULLDOWN_30
1122 #define PPS_OUT_Y0 PPS_OUT_30
1123 #define PPS_IN_Y0 PPS_IN_30
1124 
1125 #define UCPORT_Y1 UCPORT_31
1126 #define UCPORT_ID_Y1 UCPORT_ID_31
1127 #define PIN_Y1 PIN_31
1128 #define PIN_Y1_BITADR PIN_31_BITADR
1129 #define LAT_Y1 LAT_31
1130 #define LAT_Y1_BITADR LAT_31_BITADR
1131 #define DIR_Y1 DIR_31
1132 #define TRIS_Y1_BITADR TRIS_31_BITADR
1133 #define PULLUP_Y1 PULLUP_31
1134 #define PULLDOWN_Y1 PULLDOWN_31
1135 #define PPS_OUT_Y1 PPS_OUT_31
1136 #define PPS_IN_Y1 PPS_IN_31
1137 
1138 #define UCPORT_Y2 UCPORT_32
1139 #define UCPORT_ID_Y2 UCPORT_ID_32
1140 #define PIN_Y2 PIN_32
1141 #define PIN_Y2_BITADR PIN_32_BITADR
1142 #define LAT_Y2 LAT_32
1143 #define LAT_Y2_BITADR LAT_32_BITADR
1144 #define DIR_Y2 DIR_32
1145 #define TRIS_Y2_BITADR TRIS_32_BITADR
1146 #define PULLUP_Y2 PULLUP_32
1147 #define PULLDOWN_Y2 PULLDOWN_32
1148 #define PPS_OUT_Y2 PPS_OUT_32
1149 #define PPS_IN_Y2 PPS_IN_32
1150 
1151 #define UCPORT_Y3 UCPORT_33
1152 #define UCPORT_ID_Y3 UCPORT_ID_33
1153 #define PIN_Y3 PIN_33
1154 #define PIN_Y3_BITADR PIN_33_BITADR
1155 #define LAT_Y3 LAT_33
1156 #define LAT_Y3_BITADR LAT_33_BITADR
1157 #define DIR_Y3 DIR_33
1158 #define TRIS_Y3_BITADR TRIS_33_BITADR
1159 #define PULLUP_Y3 PULLUP_33
1160 #define PULLDOWN_Y3 PULLDOWN_33
1161 #define PPS_OUT_Y3 PPS_OUT_33
1162 #define PPS_IN_Y3 PPS_IN_33
1163 
1164 #define UCPORT_Y4 UCPORT_34
1165 #define UCPORT_ID_Y4 UCPORT_ID_34
1166 #define PIN_Y4 PIN_34
1167 #define PIN_Y4_BITADR PIN_34_BITADR
1168 #define LAT_Y4 LAT_34
1169 #define LAT_Y4_BITADR LAT_34_BITADR
1170 #define DIR_Y4 DIR_34
1171 #define TRIS_Y4_BITADR TRIS_34_BITADR
1172 #define PULLUP_Y4 PULLUP_34
1173 #define PULLDOWN_Y4 PULLDOWN_34
1174 #define PPS_OUT_Y4 PPS_OUT_34
1175 #define PPS_IN_Y4 PPS_IN_34
1176 
1177 #define UCPORT_Y5 UCPORT_35
1178 #define UCPORT_ID_Y5 UCPORT_ID_35
1179 #define PIN_Y5 PIN_35
1180 #define PIN_Y5_BITADR PIN_35_BITADR
1181 #define LAT_Y5 LAT_35
1182 #define LAT_Y5_BITADR LAT_35_BITADR
1183 #define DIR_Y5 DIR_35
1184 #define TRIS_Y5_BITADR TRIS_35_BITADR
1185 #define PULLUP_Y5 PULLUP_35
1186 #define PULLDOWN_Y5 PULLDOWN_35
1187 #define PPS_OUT_Y5 PPS_OUT_35
1188 #define PPS_IN_Y5 PPS_IN_35
1189 
1190 #define UCPORT_Y6 UCPORT_36
1191 #define UCPORT_ID_Y6 UCPORT_ID_36
1192 #define PIN_Y6 PIN_36
1193 #define PIN_Y6_BITADR PIN_36_BITADR
1194 #define LAT_Y6 LAT_36
1195 #define LAT_Y6_BITADR LAT_36_BITADR
1196 #define DIR_Y6 DIR_36
1197 #define TRIS_Y6_BITADR TRIS_36_BITADR
1198 #define PULLUP_Y6 PULLUP_36
1199 #define PULLDOWN_Y6 PULLDOWN_36
1200 #define PPS_OUT_Y6 PPS_OUT_36
1201 #define PPS_IN_Y6 PPS_IN_36
1202 
1203 #define UCPORT_Y7 UCPORT_37
1204 #define UCPORT_ID_Y7 UCPORT_ID_37
1205 #define PIN_Y7 PIN_37
1206 #define PIN_Y7_BITADR PIN_37_BITADR
1207 #define LAT_Y7 LAT_37
1208 #define LAT_Y7_BITADR LAT_37_BITADR
1209 #define DIR_Y7 DIR_37
1210 #define TRIS_Y7_BITADR TRIS_37_BITADR
1211 #define PULLUP_Y7 PULLUP_37
1212 #define PULLDOWN_Y7 PULLDOWN_37
1213 #define PPS_OUT_Y7 PPS_OUT_37
1214 #define PPS_IN_Y7 PPS_IN_37
1215 
1216 #define UCPORT_Y8 UCPORT_38
1217 #define UCPORT_ID_Y8 UCPORT_ID_38
1218 #define PIN_Y8 PIN_38
1219 #define PIN_Y8_BITADR PIN_38_BITADR
1220 #define LAT_Y8 LAT_38
1221 #define LAT_Y8_BITADR LAT_38_BITADR
1222 #define DIR_Y8 DIR_38
1223 #define TRIS_Y8_BITADR TRIS_38_BITADR
1224 #define PULLUP_Y8 PULLUP_38
1225 #define PULLDOWN_Y8 PULLDOWN_38
1226 #define PPS_OUT_Y8 PPS_OUT_38
1227 #define PPS_IN_Y8 PPS_IN_38
1228 
1229 #define UCPORT_Y9 UCPORT_39
1230 #define UCPORT_ID_Y9 UCPORT_ID_39
1231 #define PIN_Y9 PIN_39
1232 #define PIN_Y9_BITADR PIN_39_BITADR
1233 #define LAT_Y9 LAT_39
1234 #define LAT_Y9_BITADR LAT_39_BITADR
1235 #define DIR_Y9 DIR_39
1236 #define TRIS_Y9_BITADR TRIS_39_BITADR
1237 #define PULLUP_Y9 PULLUP_39
1238 #define PULLDOWN_Y9 PULLDOWN_39
1239 #define PPS_OUT_Y9 PPS_OUT_39
1240 #define PPS_IN_Y9 PPS_IN_39
1241 
1242 #define UCPORT_Y10 UCPORT_40
1243 #define UCPORT_ID_Y10 UCPORT_ID_40
1244 #define PIN_Y10 PIN_40
1245 #define PIN_Y10_BITADR PIN_40_BITADR
1246 #define LAT_Y10 LAT_40
1247 #define LAT_Y10_BITADR LAT_40_BITADR
1248 #define DIR_Y10 DIR_40
1249 #define TRIS_Y10_BITADR TRIS_40_BITADR
1250 #define PULLUP_Y10 PULLUP_40
1251 #define PULLDOWN_Y10 PULLDOWN_40
1252 #define PPS_OUT_Y10 PPS_OUT_40
1253 #define PPS_IN_Y10 PPS_IN_40
1254 
1255 #define UCPORT_Y11 UCPORT_41
1256 #define UCPORT_ID_Y11 UCPORT_ID_41
1257 #define PIN_Y11 PIN_41
1258 #define PIN_Y11_BITADR PIN_41_BITADR
1259 #define LAT_Y11 LAT_41
1260 #define LAT_Y11_BITADR LAT_41_BITADR
1261 #define DIR_Y11 DIR_41
1262 #define TRIS_Y11_BITADR TRIS_41_BITADR
1263 #define PULLUP_Y11 PULLUP_41
1264 #define PULLDOWN_Y11 PULLDOWN_41
1265 #define PPS_OUT_Y11 PPS_OUT_41
1266 #define PPS_IN_Y11 PPS_IN_41
1267 
1268 
1269 
1270 // *********************************************************************
1271 // --------------------------- Other IO Defines ------------------------
1272 // *********************************************************************
1273 #define PIN_SYSLED _RB6
1274 #define LAT_SYSLED _LATB6
1275 #define DIR_SYSLED _TRISB6
1276 #define PULLUP_SYSLED _CN24PUE
1277 #define PULLDOWN_SYSLED _CN24PDE
1278 
1279 
1280 
1281 // *********************************************************************
1282 // -------------------- Some general CPU Defines -----------------------
1283 // *********************************************************************
1284 #define PWM_COUNT 9 //Hardware PWM channels
1285 
1286 
1287 
1288 // *********************************************************************
1289 // ---------------------------- Analog Defines -------------------------
1290 // *********************************************************************
1291 #define ADC_REF_MV 2500 //ADC External Reference in MV
1292 #define ADC_MAX_CHAN_BRD 12 //Maximum number of possible ADC channels, B0-B5, B8-B11, B14, B15 (rev2+)
1293 
1294 //The channel mask indicates what AN channels can be used for ADC inputs
1295 #define ADC_CHANNEL_MASK_LOW_BRD 0b1100111100111111 //AN0-AN5, AN8-AN11, AN14-AN15
1296 #define ADC_CHANNEL_MASK_HIGH_BRD 0 //Only has 16 ADC channels
1297 
1298 //Index for selected analog input in adcFilter[] and adcValue[] arrays. Some analog inputs do not have space assigned for them
1299 #define ADC_CH_A0 0 //AN0
1300 #define ADC_CH_A1 1 //AN1
1301 #define ADC_CH_A2 2 //AN2
1302 #define ADC_CH_A3 3 //AN3
1303 #define ADC_CH_A4 4 //AN4
1304 #define ADC_CH_A5 5 //AN5
1305 #define ADC_CH_A6 8 //AN8
1306 #define ADC_CH_A7 9 //AN9
1307 #define ADC_CH_A8 10 //AN10
1308 #define ADC_CH_A9 11 //AN11
1309 #define ADC_CH_A10 14 //AN14
1310 #define ADC_CH_A11 15 //AN15
1311 
1312 #define ADC_OPEN_A0 0x0001 //AN0
1313 #define ADC_OPEN_A1 0x0002 //AN1
1314 #define ADC_OPEN_A2 0x0004 //AN2
1315 #define ADC_OPEN_A3 0x0008 //AN3
1316 #define ADC_OPEN_A4 0x0010 //AN4
1317 #define ADC_OPEN_A5 0x0020 //AN5
1318 #define ADC_OPEN_A6 0x0100 //AN8
1319 #define ADC_OPEN_A7 0x0200 //AN9
1320 #define ADC_OPEN_A8 0x0400 //AN10
1321 #define ADC_OPEN_A9 0x0800 //AN11
1322 #define ADC_OPEN_A10 0x4000 //AN14
1323 #define ADC_OPEN_A11 0x8000 //AN15
1324 
1325 
1326 // *********************************************************************
1327 // ------------------ Define ports for this board ----------------------
1328 // *********************************************************************
1329 #define UC_PORT_B0_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1330 #define UC_PORT_B1_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1331 #define UC_PORT_B2_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1332 #define UC_PORT_B3_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1333 #define UC_PORT_B4_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1334 #define UC_PORT_B5_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1335 #define UC_PORT_B6_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1336 #define UC_PORT_B7_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1337 #define UC_PORT_B8_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1338 #define UC_PORT_B9_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1339 #define UC_PORT_B10_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1340 #define UC_PORT_B11_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1341 #define UC_PORT_B14_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1342 #define UC_PORT_B15_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_ANALOG_IN | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1343 
1344 #define UC_PORT_D0_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V | UCPORT_PROP_INT)
1345 #define UC_PORT_D1_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1346 #define UC_PORT_D2_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1347 #define UC_PORT_D3_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1348 #define UC_PORT_D6_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1349 #define UC_PORT_D7_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1350 #define UC_PORT_D9_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V | UCPORT_PROP_SDA)
1351 #define UC_PORT_D10_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V | UCPORT_PROP_SCL)
1352 
1353 #define UC_PORT_E2_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1354 #define UC_PORT_E3_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1355 #define UC_PORT_E5_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1356 #define UC_PORT_E6_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1357 #define UC_PORT_E7_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1358 
1359 #define UC_PORT_F0_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1360 #define UC_PORT_F1_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1361 #define UC_PORT_F3_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V)
1362 #define UC_PORT_F4_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V | UCPORT_PROP_SDA)
1363 #define UC_PORT_F5_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN | UCPORT_PROP_5V | UCPORT_PROP_SCL)
1364  //G6, F7,G8,G9
1365 #define UC_PORT_G6_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1366 #define UC_PORT_G7_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1367 #define UC_PORT_G8_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1368 #define UC_PORT_G9_PROP (UCPORT_PROP_DIG_IN | UCPORT_PROP_DIG_OUT | UCPORT_PROP_OPEN_COL | UCPORT_PROP_RP | UCPORT_PROP_PULLUP | UCPORT_PROP_PULLDOWN)
1369 
1370 
1371 // *********************************************************************
1372 // --------------------- spiFlash Configuration ------------------------
1373 // *********************************************************************
1374 #define SPI_FLASH_SECTOR_SIZE (4096ul)
1375 //#define SPI_FLASH_PAGE_SIZE (0ul) // SST has no page boundary requirements
1376 #define SPI_FLASH_PAGE_SIZE (256ul) // Winbond FLASH has 256 byte pages
1377 #define SPI_FLASH_SIZE (0x400000ul) // Flash is 4MByte
1378 
1379 
1380 
1381 // *********************************************************************
1382 // ----------------- SPI External FLASH and EEPROM ---------------------
1383 // *********************************************************************
1384 // To use SST (SST25VF016B) flash, SPI_FLASH_SECTOR_SIZE is 4096, and define SPI_FLASH_PAGE_SIZE as 0.
1385 // To use Winbond flash, SPI_FLASH_SECTOR_SIZE is 4096, and define SPI_FLASH_PAGE_SIZE as 256.
1386 #define SPIFLASH_CS_TRIS (TRISBbits.TRISB13)
1387 #define SPIFLASH_CS_IO (LATBbits.LATB13)
1388 
1389 // External EEPROM I/O pins
1390 #define EEPROM_CS_TRIS (TRISBbits.TRISB12)
1391 #define EEPROM_CS_IO (LATBbits.LATB12)
1392 
1393 // To use Winbond flash, SPI_FLASH_SECTOR_SIZE is 4096, and define SPI_FLASH_PAGE_SIZE as 256.
1394 #define SPIFLASH_SPI_IF (IFS2bits.SPI2IF)
1395 #define SPIFLASH_SSPBUF (SPI2BUF)
1396 //#define SPIFLASH_SPICON1 (SPI2CON1)
1397 //#define SPIFLASH_SPICON1bits (SPI2CON1bits)
1398 //#define SPIFLASH_SPICON2 (SPI2CON2)
1399 #define SPIFLASH_SPISTAT (SPI2STAT)
1400 #define SPIFLASH_SPISTATbits (SPI2STATbits)
1401 
1402 // External EEPROM
1403 #define EEPROM_SPI_IF (IFS2bits.SPI2IF)
1404 #define EEPROM_SSPBUF (SPI2BUF)
1405 //#define EEPROM_SPICON1 (SPI2CON1)
1406 //#define EEPROM_SPICON1bits (SPI2CON1bits)
1407 //#define EEPROM_SPICON2 (SPI2CON2)
1408 #define EEPROM_SPISTAT (SPI2STAT)
1409 #define EEPROM_SPISTATbits (SPI2STATbits)
1410 
1411 
1412 
1413 // *********************************************************************
1414 // ----------- SPI External Mememory Bus Defines for SBC66UAL -----------
1415 // *********************************************************************
1416 #define SPIMEM_SPI_IF (IFS2bits.SPI2IF)
1417 #define SPIMEM_SSPBUF (SPI2BUF)
1418 #define SPIMEM_SPICON1 (SPI2CON1)
1419 #define SPIMEM_SPICON1bits (SPI2CON1bits)
1420 #define SPIMEM_SPICON2 (SPI2CON2)
1421 #define SPIMEM_SPISTAT (SPI2STAT)
1422 #define SPIMEM_SPISTATbits (SPI2STATbits)
1423 
1424 // These defines are for the SPI bus used for the external FLASH and EEPROM
1425 #define PIN_SPIMEM_SDO _RD8
1426 #define LAT_SPIMEM_SDO _LATD8
1427 #define DIR_SPIMEM_SDO _TRISD8
1428 #define PULLUP_SPIMEM_SDO _CN53PUE
1429 #define PULLDOWN_SPIMEM_SDO _CN53PDE
1430 #define PPS_OUT_SPIMEM_SDO OUT_PIN_PPS_RP2
1431 
1432 #define PIN_SPIMEM_SCK _RD11
1433 #define LAT_SPIMEM_SCK _LATD11
1434 #define DIR_SPIMEM_SCK _TRISD11
1435 #define PULLUP_SPIMEM_SCK _CN56PUE
1436 #define PULLDOWN_SPIMEM_SCK _CN56PDE
1437 #define PPS_OUT_SPIMEM_SCK OUT_PIN_PPS_RP12
1438 
1439 #define PIN_SPIMEM_SDI _RC14
1440 #define LAT_SPIMEM_SDI _LATC14
1441 #define DIR_SPIMEM_SDI _TRISC14
1442 #define PULLUP_SPIMEM_SDI _CN0PUE
1443 #define PULLDOWN_SPIMEM_SDI _CN0PDE
1444 #define PPS_IN_SPIMEM_SDI IN_PIN_PPS_RPI37
1445 
1446 
1447 
1448 // *********************************************************************
1449 // -------------- USB stack hardware selection options -----------------
1450 // *********************************************************************
1451 //This section is the set of definitions required by the MCHPFSUSB framework. These definitions
1452 //tell the firmware what mode it is running in, and are required by every application developed
1453 //with this revision of the MCHPFSUSB framework.
1454 
1455 //#define USE_SELF_POWER_SENSE_IO
1456 //#define tris_self_power TRISAbits.TRISA2 // Input
1457 #define self_power 1
1458 
1459 //#define USE_USB_BUS_SENSE_IO
1460 //#define tris_usb_bus_sense TRISBbits.TRISB5 // Input
1461 #define USB_BUS_SENSE U1OTGSTATbits.SESVD
1462 
1463 
1464 
1465 // *******************************************************
1466 // ----------------- xEeprom Configuration -----------------
1467 // ********************************************************
1468 #define XEEPROM_SIZE (8192) //Default EEPROM is 25LC640 = 64kBits = 8kBytes)
1469 #define XEEPROM_PAGE_SIZE (32)
1470 
1471 
1482 #define GET_UCPORT_PROP_OFFSET(ucPort) (offsetof(CFG_STRUCT, ucPortProp) + ((offsetof(TABLE_BLOCK_UC66_PORT, ucPort)/sizeof(UCPORT_PROP)) * sizeof(UCPORT_PROP)) )
1483 
1494 #define GET_UCPORT_CONFIG_OFFSET(ucPortVal) (offsetof(CFG_STRUCT, ucPort) + ((offsetof(CFG_BLOCK_UC66_PORT, ucPortVal)/sizeof(UCPORT_CONFIG)) * sizeof(UCPORT_CONFIG)) )
1495 
1496 #endif //#if defined(BRD_SBC66UAL_R1)
1497 #endif