Digital Power Starter Kit 3 Firmware
DM330017-3, Rev.3.0
dsPIC33C Buck Converter Peak Current Mode Control Example
dev_buck_ptemp_pwm.h
1
33
/*
34
* File: dev_buck_ptemp_pwm.h
35
* Author: M91406
36
* Comments: PWM Peripheral Special Function Register Configuration Template
37
* Revision history:
38
* 10/29/2020 1.0 initial release
39
*/
40
41
// This is a guard condition so that contents of this file are not included
42
// more than once.
43
#ifndef BUCK_CONVERTER_PERIPHERAL_CONFIGURATION_PWM_H
44
#define BUCK_CONVERTER_PERIPHERAL_CONFIGURATION_PWM_H
45
46
#include <xc.h>
// include processor files - each processor file is guarded.
47
#include <stdint.h>
// include standard integer data types
48
#include <stdbool.h>
// include standard boolean data types
49
#include <stddef.h>
// include standard definition data types
50
55
/* ********************************************************************************
56
* PWM MODULE BASE REGISTER CONFIGURATION
57
* *******************************************************************************/
62
/*
63
________________ BIT 15: HRRDY: High-Resolution Ready bit
64
| _______________ BIT 14: HRERR: High-Resolution Error bit
65
|| ______________ BIT 13: (unimplemented)
66
||| _____________ BIT 12: (unimplemented)
67
|||| ____________ BIT 11: (unimplemented)
68
||||| ___________ BIT 10: (unimplemented)
69
|||||| __________ BIT 9: (unimplemented)
70
||||||| _________ BIT 8: LOCK: Lock bit
71
|||||||| ________ BIT 7: (unimplemented)
72
||||||||| _______ BIT 6: (unimplemented)
73
|||||||||| ______ BIT 5: DIVSEL[1:0]: PWM Clock Divider Selection bits
74
||||||||||| _____ BIT 4:
75
|||||||||||| ____ BIT 3: (unimplemented)
76
||||||||||||| ___ BIT 2: (unimplemented)
77
|||||||||||||| __ BIT 1: MCLKSEL[1:0]: PWM Master Clock Selection bits
78
||||||||||||||| _ BIT 0:
79
|||||||||||||||| */
80
#define REG_PCLKCON 0b0000000000000011
81
86
/*
87
88
________________ BIT 15: (unimplemented)
89
| _______________ BIT 14: (unimplemented)
90
|| ______________ BIT 13: (unimplemented)
91
||| _____________ BIT 12: (unimplemented)
92
|||| ____________ BIT 11: (unimplemented)
93
||||| ___________ BIT 10: (unimplemented)
94
|||||| __________ BIT 9: (unimplemented)
95
||||||| _________ BIT 8: (unimplemented)
96
|||||||| ________ BIT 7: CTA8EN: Enable Trigger Output from PWM Generator #8 as Source for Combinational Trigger A bit
97
||||||||| _______ BIT 6: CTA7EN: Enable Trigger Output from PWM Generator #7 as Source for Combinational Trigger A bit
98
|||||||||| ______ BIT 5: CTA6EN: Enable Trigger Output from PWM Generator #6 as Source for Combinational Trigger A bit
99
||||||||||| _____ BIT 4: CTA5EN: Enable Trigger Output from PWM Generator #5 as Source for Combinational Trigger A bit
100
|||||||||||| ____ BIT 3: CTA4EN: Enable Trigger Output from PWM Generator #4 as Source for Combinational Trigger A bit
101
||||||||||||| ___ BIT 2: CTA3EN: Enable Trigger Output from PWM Generator #3 as Source for Combinational Trigger A bit
102
|||||||||||||| __ BIT 1: CTA2EN: Enable Trigger Output from PWM Generator #2 as Source for Combinational Trigger A bit
103
||||||||||||||| _ BIT 0: CTA1EN: Enable Trigger Output from PWM Generator #1 as Source for Combinational Trigger A bit
104
|||||||||||||||| */
105
#define REG_CMBTRIGL 0b0000000000000000
106
111
/* CMBTRIGH: COMBINATIONAL TRIGGER REGISTER HIGH
112
113
________________ BIT 15: (unimplemented)
114
| _______________ BIT 14: (unimplemented)
115
|| ______________ BIT 13: (unimplemented)
116
||| _____________ BIT 12: (unimplemented)
117
|||| ____________ BIT 11: (unimplemented)
118
||||| ___________ BIT 10: (unimplemented)
119
|||||| __________ BIT 9: (unimplemented)
120
||||||| _________ BIT 8: (unimplemented)
121
|||||||| ________ BIT 7: CTB8EN: Enable Trigger Output from PWM Generator #8 as Source for Combinational Trigger B bit
122
||||||||| _______ BIT 6: CTB7EN: Enable Trigger Output from PWM Generator #7 as Source for Combinational Trigger B bit
123
|||||||||| ______ BIT 5: CTB6EN: Enable Trigger Output from PWM Generator #6 as Source for Combinational Trigger B bit
124
||||||||||| _____ BIT 4: CTB5EN: Enable Trigger Output from PWM Generator #5 as Source for Combinational Trigger B bit
125
|||||||||||| ____ BIT 3: CTB4EN: Enable Trigger Output from PWM Generator #4 as Source for Combinational Trigger B bit
126
||||||||||||| ___ BIT 2: CTB3EN: Enable Trigger Output from PWM Generator #3 as Source for Combinational Trigger B bit
127
|||||||||||||| __ BIT 1: CTB2EN: Enable Trigger Output from PWM Generator #2 as Source for Combinational Trigger B bit
128
||||||||||||||| _ BIT 0: CTB1EN: Enable Trigger Output from PWM Generator #1 as Source for Combinational Trigger B bit
129
|||||||||||||||| */
130
#define REG_CMBTRIGH 0b0000000000000000
131
136
/*
137
138
________________ BIT 15: PWMS1y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
139
| _______________ BIT 14:
140
|| ______________ BIT 13:
141
||| _____________ BIT 12:
142
|||| ____________ BIT 11: PWMS2y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
143
||||| ___________ BIT 10:
144
|||||| __________ BIT 9:
145
||||||| _________ BIT 8:
146
|||||||| ________ BIT 7: S1yPOL: Combinatorial PWM Logic Source #1 Polarity bit
147
||||||||| _______ BIT 6: S2yPOL: Combinatorial PWM Logic Source #2 Polarity bit
148
|||||||||| ______ BIT 5: PWMLFy[1:0]: Combinatorial PWM Logic Function Selection bits
149
||||||||||| _____ BIT 4:
150
|||||||||||| ____ BIT 3: (unimplemented)
151
||||||||||||| ___ BIT 2: PWMLFyD[2:0]: Combinatorial PWM Logic Destination Selection bits
152
|||||||||||||| __ BIT 1:
153
||||||||||||||| _ BIT 0:
154
|||||||||||||||| */
155
#define REG_LOGCONA 0b0000000000000000
156
161
/* LOGCONB: COMBINATORIAL PWM LOGIC CONTROL REGISTER B
162
163
________________ BIT 15: PWMS1y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
164
| _______________ BIT 14:
165
|| ______________ BIT 13:
166
||| _____________ BIT 12:
167
|||| ____________ BIT 11: PWMS2y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
168
||||| ___________ BIT 10:
169
|||||| __________ BIT 9:
170
||||||| _________ BIT 8:
171
|||||||| ________ BIT 7: S1yPOL: Combinatorial PWM Logic Source #1 Polarity bit
172
||||||||| _______ BIT 6: S2yPOL: Combinatorial PWM Logic Source #2 Polarity bit
173
|||||||||| ______ BIT 5: PWMLFy[1:0]: Combinatorial PWM Logic Function Selection bits
174
||||||||||| _____ BIT 4:
175
|||||||||||| ____ BIT 3: (unimplemented)
176
||||||||||||| ___ BIT 2: PWMLFyD[2:0]: Combinatorial PWM Logic Destination Selection bits
177
|||||||||||||| __ BIT 1:
178
||||||||||||||| _ BIT 0:
179
|||||||||||||||| */
180
#define REG_LOGCONB 0b0000000000000000
181
186
/*
187
188
________________ BIT 15: PWMS1y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
189
| _______________ BIT 14:
190
|| ______________ BIT 13:
191
||| _____________ BIT 12:
192
|||| ____________ BIT 11: PWMS2y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
193
||||| ___________ BIT 10:
194
|||||| __________ BIT 9:
195
||||||| _________ BIT 8:
196
|||||||| ________ BIT 7: S1yPOL: Combinatorial PWM Logic Source #1 Polarity bit
197
||||||||| _______ BIT 6: S2yPOL: Combinatorial PWM Logic Source #2 Polarity bit
198
|||||||||| ______ BIT 5: PWMLFy[1:0]: Combinatorial PWM Logic Function Selection bits
199
||||||||||| _____ BIT 4:
200
|||||||||||| ____ BIT 3: (unimplemented)
201
||||||||||||| ___ BIT 2: PWMLFyD[2:0]: Combinatorial PWM Logic Destination Selection bits
202
|||||||||||||| __ BIT 1:
203
||||||||||||||| _ BIT 0:
204
|||||||||||||||| */
205
#define REG_LOGCONC 0b0000000000000000
206
211
/*
212
213
________________ BIT 15: PWMS1y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
214
| _______________ BIT 14:
215
|| ______________ BIT 13:
216
||| _____________ BIT 12:
217
|||| ____________ BIT 11: PWMS2y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
218
||||| ___________ BIT 10:
219
|||||| __________ BIT 9:
220
||||||| _________ BIT 8:
221
|||||||| ________ BIT 7: S1yPOL: Combinatorial PWM Logic Source #1 Polarity bit
222
||||||||| _______ BIT 6: S2yPOL: Combinatorial PWM Logic Source #2 Polarity bit
223
|||||||||| ______ BIT 5: PWMLFy[1:0]: Combinatorial PWM Logic Function Selection bits
224
||||||||||| _____ BIT 4:
225
|||||||||||| ____ BIT 3: (unimplemented)
226
||||||||||||| ___ BIT 2: PWMLFyD[2:0]: Combinatorial PWM Logic Destination Selection bits
227
|||||||||||||| __ BIT 1:
228
||||||||||||||| _ BIT 0:
229
|||||||||||||||| */
230
#define REG_LOGCOND 0b0000000000000000
231
236
/*
237
238
________________ BIT 15: PWMS1y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
239
| _______________ BIT 14:
240
|| ______________ BIT 13:
241
||| _____________ BIT 12:
242
|||| ____________ BIT 11: PWMS2y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
243
||||| ___________ BIT 10:
244
|||||| __________ BIT 9:
245
||||||| _________ BIT 8:
246
|||||||| ________ BIT 7: S1yPOL: Combinatorial PWM Logic Source #1 Polarity bit
247
||||||||| _______ BIT 6: S2yPOL: Combinatorial PWM Logic Source #2 Polarity bit
248
|||||||||| ______ BIT 5: PWMLFy[1:0]: Combinatorial PWM Logic Function Selection bits
249
||||||||||| _____ BIT 4:
250
|||||||||||| ____ BIT 3: (unimplemented)
251
||||||||||||| ___ BIT 2: PWMLFyD[2:0]: Combinatorial PWM Logic Destination Selection bits
252
|||||||||||||| __ BIT 1:
253
||||||||||||||| _ BIT 0:
254
|||||||||||||||| */
255
#define REG_LOGCONE 0b0000000000000000
256
261
/*
262
263
________________ BIT 15: PWMS1y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
264
| _______________ BIT 14:
265
|| ______________ BIT 13:
266
||| _____________ BIT 12:
267
|||| ____________ BIT 11: PWMS2y[3:0]: Combinatorial PWM Logic Source #1 Selection bits
268
||||| ___________ BIT 10:
269
|||||| __________ BIT 9:
270
||||||| _________ BIT 8:
271
|||||||| ________ BIT 7: S1yPOL: Combinatorial PWM Logic Source #1 Polarity bit
272
||||||||| _______ BIT 6: S2yPOL: Combinatorial PWM Logic Source #2 Polarity bit
273
|||||||||| ______ BIT 5: PWMLFy[1:0]: Combinatorial PWM Logic Function Selection bits
274
||||||||||| _____ BIT 4:
275
|||||||||||| ____ BIT 3: (unimplemented)
276
||||||||||||| ___ BIT 2: PWMLFyD[2:0]: Combinatorial PWM Logic Destination Selection bits
277
|||||||||||||| __ BIT 1:
278
||||||||||||||| _ BIT 0:
279
|||||||||||||||| */
280
#define REG_LOGCONF 0b0000000000000000
281
286
/*
287
288
________________ BIT 15: EVTyOEN: PWM Event Output Enable bit
289
| _______________ BIT 14: EVTyPOL: PWM Event Output Polarity bit
290
|| ______________ BIT 13: EVTySTRD: PWM Event Output Stretch Disable bit
291
||| _____________ BIT 12: EVTySYNC: PWM Event Output Sync bit
292
|||| ____________ BIT 11: (unimplemented)
293
||||| ___________ BIT 10: (unimplemented)
294
|||||| __________ BIT 9: (unimplemented)
295
||||||| _________ BIT 8: (unimplemented)
296
|||||||| ________ BIT 7: EVTySEL[3:0]: PWM Event Selection bits
297
||||||||| _______ BIT 6:
298
|||||||||| ______ BIT 5:
299
||||||||||| _____ BIT 4:
300
|||||||||||| ____ BIT 3: (unimplemented)
301
||||||||||||| ___ BIT 2: EVTyPGS[2:0]: PWM Event Source Selection bits
302
|||||||||||||| __ BIT 1:
303
||||||||||||||| _ BIT 0:
304
|||||||||||||||| */
305
#define REG_PWMEVTA 0b0000000000000000
306
311
/*
312
313
________________ BIT 15: EVTyOEN: PWM Event Output Enable bit
314
| _______________ BIT 14: EVTyPOL: PWM Event Output Polarity bit
315
|| ______________ BIT 13: EVTySTRD: PWM Event Output Stretch Disable bit
316
||| _____________ BIT 12: EVTySYNC: PWM Event Output Sync bit
317
|||| ____________ BIT 11: (unimplemented)
318
||||| ___________ BIT 10: (unimplemented)
319
|||||| __________ BIT 9: (unimplemented)
320
||||||| _________ BIT 8: (unimplemented)
321
|||||||| ________ BIT 7: EVTySEL[3:0]: PWM Event Selection bits
322
||||||||| _______ BIT 6:
323
|||||||||| ______ BIT 5:
324
||||||||||| _____ BIT 4:
325
|||||||||||| ____ BIT 3: (unimplemented)
326
||||||||||||| ___ BIT 2: EVTyPGS[2:0]: PWM Event Source Selection bits
327
|||||||||||||| __ BIT 1:
328
||||||||||||||| _ BIT 0:
329
|||||||||||||||| */
330
#define REG_PWMEVTB 0b0000000000000000
331
336
/*
337
338
________________ BIT 15: EVTyOEN: PWM Event Output Enable bit
339
| _______________ BIT 14: EVTyPOL: PWM Event Output Polarity bit
340
|| ______________ BIT 13: EVTySTRD: PWM Event Output Stretch Disable bit
341
||| _____________ BIT 12: EVTySYNC: PWM Event Output Sync bit
342
|||| ____________ BIT 11: (unimplemented)
343
||||| ___________ BIT 10: (unimplemented)
344
|||||| __________ BIT 9: (unimplemented)
345
||||||| _________ BIT 8: (unimplemented)
346
|||||||| ________ BIT 7: EVTySEL[3:0]: PWM Event Selection bits
347
||||||||| _______ BIT 6:
348
|||||||||| ______ BIT 5:
349
||||||||||| _____ BIT 4:
350
|||||||||||| ____ BIT 3: (unimplemented)
351
||||||||||||| ___ BIT 2: EVTyPGS[2:0]: PWM Event Source Selection bits
352
|||||||||||||| __ BIT 1:
353
||||||||||||||| _ BIT 0:
354
|||||||||||||||| */
355
#define REG_PWMEVTC 0b0000000000000000
356
361
/*
362
363
________________ BIT 15: EVTyOEN: PWM Event Output Enable bit
364
| _______________ BIT 14: EVTyPOL: PWM Event Output Polarity bit
365
|| ______________ BIT 13: EVTySTRD: PWM Event Output Stretch Disable bit
366
||| _____________ BIT 12: EVTySYNC: PWM Event Output Sync bit
367
|||| ____________ BIT 11: (unimplemented)
368
||||| ___________ BIT 10: (unimplemented)
369
|||||| __________ BIT 9: (unimplemented)
370
||||||| _________ BIT 8: (unimplemented)
371
|||||||| ________ BIT 7: EVTySEL[3:0]: PWM Event Selection bits
372
||||||||| _______ BIT 6:
373
|||||||||| ______ BIT 5:
374
||||||||||| _____ BIT 4:
375
|||||||||||| ____ BIT 3: (unimplemented)
376
||||||||||||| ___ BIT 2: EVTyPGS[2:0]: PWM Event Source Selection bits
377
|||||||||||||| __ BIT 1:
378
||||||||||||||| _ BIT 0:
379
|||||||||||||||| */
380
#define REG_PWMEVTD 0b0000000000000000
381
386
/*
387
388
________________ BIT 15: EVTyOEN: PWM Event Output Enable bit
389
| _______________ BIT 14: EVTyPOL: PWM Event Output Polarity bit
390
|| ______________ BIT 13: EVTySTRD: PWM Event Output Stretch Disable bit
391
||| _____________ BIT 12: EVTySYNC: PWM Event Output Sync bit
392
|||| ____________ BIT 11: (unimplemented)
393
||||| ___________ BIT 10: (unimplemented)
394
|||||| __________ BIT 9: (unimplemented)
395
||||||| _________ BIT 8: (unimplemented)
396
|||||||| ________ BIT 7: EVTySEL[3:0]: PWM Event Selection bits
397
||||||||| _______ BIT 6:
398
|||||||||| ______ BIT 5:
399
||||||||||| _____ BIT 4:
400
|||||||||||| ____ BIT 3: (unimplemented)
401
||||||||||||| ___ BIT 2: EVTyPGS[2:0]: PWM Event Source Selection bits
402
|||||||||||||| __ BIT 1:
403
||||||||||||||| _ BIT 0:
404
|||||||||||||||| */
405
#define REG_PWMEVTE 0b0000000000000000
406
411
/*
412
413
________________ BIT 15: EVTyOEN: PWM Event Output Enable bit
414
| _______________ BIT 14: EVTyPOL: PWM Event Output Polarity bit
415
|| ______________ BIT 13: EVTySTRD: PWM Event Output Stretch Disable bit
416
||| _____________ BIT 12: EVTySYNC: PWM Event Output Sync bit
417
|||| ____________ BIT 11: (unimplemented)
418
||||| ___________ BIT 10: (unimplemented)
419
|||||| __________ BIT 9: (unimplemented)
420
||||||| _________ BIT 8: (unimplemented)
421
|||||||| ________ BIT 7: EVTySEL[3:0]: PWM Event Selection bits
422
||||||||| _______ BIT 6:
423
|||||||||| ______ BIT 5:
424
||||||||||| _____ BIT 4:
425
|||||||||||| ____ BIT 3: (unimplemented)
426
||||||||||||| ___ BIT 2: EVTyPGS[2:0]: PWM Event Source Selection bits
427
|||||||||||||| __ BIT 1:
428
||||||||||||||| _ BIT 0:
429
|||||||||||||||| */
430
#define REG_PWMEVTF 0b0000000000000000
431
432
/* ********************************************************************************
433
* PWM GENERATOR CONFIGURATION
434
* *******************************************************************************/
439
#define P33C_PGxCONL_PWM_ON 0x8000
444
#define P33C_PGxCONL_HRES_EN 0x0080
449
#define P33C_PGxIOCONL_OVREN_SYNC 0x3000
454
#define P33C_PGxIOCONL_OVREN_ASYNC 0x2000
455
#define P33C_PGxIOCONL_OVREN_ASYNC_SWAP 0x1000
460
#define P33C_PGxIOCONH_PEN_SYNC 0x000C
465
#define P33C_PGxIOCONH_PEN_ASYNC 0x0008
466
#define P33C_PGxIOCONH_PEN_ASYNC_SWAP 0x0004
471
#define P33C_PGxSTAT_UPDREQ 0x0008
476
#define P33C_PGxCONH_MPERSEL 0x4000
481
#define P33C_PGxCONH_UPDMOD_MSTR 0b001
486
#define P33C_PGxCONH_UPDMOD_SLV 0b011
487
488
// ==============================================================================================
489
// BUCK converter Peripheral Configuration for Voltage and Average Current Mode Control
490
// ==============================================================================================
495
/*
496
497
________________ BIT 15: ON: Enable: PWM Generator Enable
498
| _______________ BIT 14: (reserved)
499
|| ______________ BIT 13: (unimplemented)
500
||| _____________ BIT 12: (unimplemented)
501
|||| ____________ BIT 11: (unimplemented)
502
||||| ___________ BIT 10: TRGCNT[2:0]: Trigger Count Selection
503
|||||| __________ BIT 9:
504
||||||| _________ BIT 8:
505
|||||||| ________ BIT 7: HREN: PWM Generator x High-Resolution Enable
506
||||||||| _______ BIT 6: (unimplemented)
507
|||||||||| ______ BIT 5: (unimplemented)
508
||||||||||| _____ BIT 4: CLKSEL[1:0]: Clock Selection
509
|||||||||||| ____ BIT 3:
510
||||||||||||| ___ BIT 2: MODSEL[2:0]: Mode Selection
511
|||||||||||||| __ BIT 1:
512
||||||||||||||| _ BIT 0:
513
|||||||||||||||| */
514
#define REG_PGxCONL 0b0000000010001000
515
520
/*
521
522
________________ BIT 15: MDCSEL: Master Duty Cycle Register Selection: 0 = PWM Generator uses PGxDC register
523
| _______________ BIT 14: MPERSEL: Master Period Register Selection: 1 = PWM Generator uses MPER register
524
|| ______________ BIT 13: MPHSEL: Master Phase Register Selection: 0 = PWM Generator uses PGxPHASE register
525
||| _____________ BIT 12: (unimplemented)
526
|||| ____________ BIT 11: MSTEN: Master Update Enable: 0 = PWM Generator does not broadcast the UPDREQ status bit state or EOC signal
527
||||| ___________ BIT 10: UPDMOD[2:0]: PWM Buffer Update Mode Selection: 001 = Immediate update
528
|||||| __________ BIT 9:
529
||||||| _________ BIT 8:
530
|||||||| ________ BIT 7: (reserved)
531
||||||||| _______ BIT 6: TRGMOD: PWM Generator Trigger Mode Selection: PWM Generator operates in Retriggerable mode
532
|||||||||| ______ BIT 5: (unimplemented)
533
||||||||||| _____ BIT 4: (unimplemented)
534
|||||||||||| ____ BIT 3: SOCS[3:0]: Start-of-Cycle Selection: Local EOC ? PWM Generator is self-triggered
535
||||||||||||| ___ BIT 2:
536
|||||||||||||| __ BIT 1:
537
||||||||||||||| _ BIT 0:
538
|||||||||||||||| */
539
#define REG_PGxCONH 0b0000000100000000
540
545
/* PGxIOCONL: PWM GENERATOR x I/O CONTROL REGISTER LOW
546
547
________________ BIT 15: CLMOD: Current-Limit Mode Selection
548
| _______________ BIT 14: SWAP: Swap PWM Signals to PWMxH and PWMxL Device Pins
549
|| ______________ BIT 13: OVRENH: User Override Enable for PWMxH Pin
550
||| _____________ BIT 12: OVRENL: User Override Enable for PWMxL Pin
551
|||| ____________ BIT 11: OVRDAT[1:0]: Data for PWMxH/PWMxL Pins if Override is Enabled
552
||||| ___________ BIT 10:
553
|||||| __________ BIT 9: OSYNC[1:0]: User Output Override Synchronization Control
554
||||||| _________ BIT 8:
555
|||||||| ________ BIT 7: FLTDAT[1:0]: Data for PWMxH/PWMxL Pins if Fault Event is Active
556
||||||||| _______ BIT 6:
557
|||||||||| ______ BIT 5: CLDAT[1:0]: Data for PWMxH/PWMxL Pins if Current-Limit Event is Active
558
||||||||||| _____ BIT 4:
559
|||||||||||| ____ BIT 3: FFDAT[1:0]: Data for PWMxH/PWMxL Pins if Feed-Forward Event is Active
560
||||||||||||| ___ BIT 2:
561
|||||||||||||| __ BIT 1: DBDAT[1:0]: Data for PWMxH/PWMxL Pins if Debug Mode is Active
562
||||||||||||||| _ BIT 0:
563
|||||||||||||||| */
564
#define REG_PGxIOCONL 0b0011000000000000
565
#define REG_PGxIOCONLPC 0b0011000000000100
566
571
/*
572
573
________________ BIT 15: (unimplemented)
574
| _______________ BIT 14: CAPSRC[2:0]: Time Base Capture Source Selection
575
|| ______________ BIT 13:
576
||| _____________ BIT 12:
577
|||| ____________ BIT 11: (unimplemented)
578
||||| ___________ BIT 10: (unimplemented)
579
|||||| __________ BIT 9: (unimplemented)
580
||||||| _________ BIT 8: DTCMPSEL: Dead-Time Compensation Select
581
|||||||| ________ BIT 7: (unimplemented)
582
||||||||| _______ BIT 6: (unimplemented)
583
|||||||||| ______ BIT 5: PMOD[1:0]: PWM Generator Output Mode Selection
584
||||||||||| _____ BIT 4:
585
|||||||||||| ____ BIT 3: PENH: PWMxH Output Port Enable
586
||||||||||||| ___ BIT 2: PENL: PWMxL Output Port Enable
587
|||||||||||||| __ BIT 1: POLH: PWMxH Output Polarity
588
||||||||||||||| _ BIT 0: POLL: PWMxL Output Polarity
589
|||||||||||||||| */
590
#define REG_PGxIOCONH 0b0000000000000000
591
596
/*
597
598
________________ BIT 15: ADTR1PS[4:0]: ADC Trigger 1 Postscaler Selection
599
| _______________ BIT 14:
600
|| ______________ BIT 13:
601
||| _____________ BIT 12:
602
|||| ____________ BIT 11:
603
||||| ___________ BIT 10: ADTR1EN3: ADC Trigger 1 Source is PGxTRIGC Compare Event Enable
604
|||||| __________ BIT 9: ADTR1EN2: ADC Trigger 1 Source is PGxTRIGB Compare Event Enable
605
||||||| _________ BIT 8: ADTR1EN1: ADC Trigger 1 Source is PGxTRIGA Compare Event Enable
606
|||||||| ________ BIT 7: (unimplemented)
607
||||||||| _______ BIT 6: (unimplemented)
608
|||||||||| ______ BIT 5: (unimplemented)
609
||||||||||| _____ BIT 4: UPDTRG[1:0]: Update Trigger Selection
610
|||||||||||| ____ BIT 3:
611
||||||||||||| ___ BIT 2: PGTRGSEL[2:0]: PWM Generator Trigger Output Selection
612
|||||||||||||| __ BIT 1:
613
||||||||||||||| _ BIT 0:
614
|||||||||||||||| */
615
#define REG_PGxEVTL 0b0000000100011001
616
621
/*
622
623
________________ BIT 15: FLTIEN: PCI Fault Interrupt Enable
624
| _______________ BIT 14: CLIEN: PCI Current-Limit Interrupt Enable
625
|| ______________ BIT 13: FFIEN: PCI Feed-Forward Interrupt Enable
626
||| _____________ BIT 12: SIEN: PCI Sync Interrupt Enable
627
|||| ____________ BIT 11: (unimplemented)
628
||||| ___________ BIT 10: (unimplemented)
629
|||||| __________ BIT 9: IEVTSEL[1:0]: Interrupt Event Selection = Interrupts CPU at TRIGA compare event
630
||||||| _________ BIT 8:
631
|||||||| ________ BIT 7: ADTR2EN3: ADC Trigger 2 Source is PGxTRIGC Compare Event Enable
632
||||||||| _______ BIT 6: ADTR2EN2: ADC Trigger 2 Source is PGxTRIGB Compare Event Enable
633
|||||||||| ______ BIT 5: ADTR2EN1: ADC Trigger 2 Source is PGxTRIGA Compare Event Enable
634
||||||||||| _____ BIT 4: ADTR1OFS[4:0]: ADC Trigger 1 Offset Selection
635
|||||||||||| ____ BIT 3:
636
||||||||||||| ___ BIT 2:
637
|||||||||||||| __ BIT 1:
638
||||||||||||||| _ BIT 0:
639
|||||||||||||||| */
640
#define REG_PGxEVTH 0b0000000101000000
641
646
/*
647
648
________________ BIT 15: TSYNCDIS: Termination Synchronization Disable
649
| _______________ BIT 14: TERM[2:0]: Termination Event Selection
650
|| ______________ BIT 13:
651
||| _____________ BIT 12:
652
|||| ____________ BIT 11: AQPS: Acceptance Qualifier Polarity Selection
653
||||| ___________ BIT 10: AQSS[2:0]: Acceptance Qualifier Source Selection
654
|||||| __________ BIT 9:
655
||||||| _________ BIT 8:
656
|||||||| ________ BIT 7: SWTERM: PCI Software Termination
657
||||||||| _______ BIT 6: PSYNC: PCI Synchronization Control
658
|||||||||| ______ BIT 5: PPS: PCI Polarity Selection
659
||||||||||| _____ BIT 4: PSS[4:0]: PCI Source Selection
660
|||||||||||| ____ BIT 3:
661
||||||||||||| ___ BIT 2:
662
|||||||||||||| __ BIT 1:
663
||||||||||||||| _ BIT 0:
664
|||||||||||||||| */
665
#define REG_PGxFPCIL 0b0000000000000000
666
671
/*
672
673
________________ BIT 15: BPEN: PCI Bypass Enable
674
| _______________ BIT 14: BPSEL[2:0]: PCI Bypass Source Selection
675
|| ______________ BIT 13:
676
||| _____________ BIT 12:
677
|||| ____________ BIT 11: (unimplemented)
678
||||| ___________ BIT 10: ACP[2:0]: PCI Acceptance Criteria Selection
679
|||||| __________ BIT 9:
680
||||||| _________ BIT 8:
681
|||||||| ________ BIT 7: SWPCI: Software PCI Control
682
||||||||| _______ BIT 6: SWPCIM[1:0]: Software PCI Control Mode
683
|||||||||| ______ BIT 5:
684
||||||||||| _____ BIT 4: LATMOD: PCI SR Latch Mode
685
|||||||||||| ____ BIT 3: TQPS: Termination Qualifier Polarity Selection
686
||||||||||||| ___ BIT 2: TQSS[2:0]: Termination Qualifier Source Selection
687
|||||||||||||| __ BIT 1:
688
||||||||||||||| _ BIT 0:
689
|||||||||||||||| */
690
#define REG_PGxFPCIH 0b0000000000000000
691
696
/*
697
698
________________ BIT 15: TSYNCDIS: Termination Synchronization Disable
699
| _______________ BIT 14: TERM[2:0]: Termination Event Selection
700
|| ______________ BIT 13:
701
||| _____________ BIT 12:
702
|||| ____________ BIT 11: AQPS: Acceptance Qualifier Polarity Selection
703
||||| ___________ BIT 10: AQSS[2:0]: Acceptance Qualifier Source Selection
704
|||||| __________ BIT 9:
705
||||||| _________ BIT 8:
706
|||||||| ________ BIT 7: SWTERM: PCI Software Termination
707
||||||||| _______ BIT 6: PSYNC: PCI Synchronization Control
708
|||||||||| ______ BIT 5: PPS: PCI Polarity Selection
709
||||||||||| _____ BIT 4: PSS[4:0]: PCI Source Selection
710
|||||||||||| ____ BIT 3:
711
||||||||||||| ___ BIT 2:
712
|||||||||||||| __ BIT 1:
713
||||||||||||||| _ BIT 0:
714
|||||||||||||||| */
715
#define REG_PGxCLPCIL 0b0000000000000000
// Voltage and Average Current Mode Configuration
716
721
/*
722
723
________________ BIT 15: BPEN: PCI Bypass Enable
724
| _______________ BIT 14: BPSEL[2:0]: PCI Bypass Source Selection
725
|| ______________ BIT 13:
726
||| _____________ BIT 12:
727
|||| ____________ BIT 11: (unimplemented)
728
||||| ___________ BIT 10: ACP[2:0]: PCI Acceptance Criteria Selection
729
|||||| __________ BIT 9:
730
||||||| _________ BIT 8:
731
|||||||| ________ BIT 7: SWPCI: Software PCI Control
732
||||||||| _______ BIT 6: SWPCIM[1:0]: Software PCI Control Mode
733
|||||||||| ______ BIT 5:
734
||||||||||| _____ BIT 4: LATMOD: PCI SR Latch Mode
735
|||||||||||| ____ BIT 3: TQPS: Termination Qualifier Polarity Selection
736
||||||||||||| ___ BIT 2: TQSS[2:0]: Termination Qualifier Source Selection
737
|||||||||||||| __ BIT 1:
738
||||||||||||||| _ BIT 0:
739
|||||||||||||||| */
740
#define REG_PGxCLPCIH 0b0000000000000000
// Voltage and Average Current Mode Configuration
741
746
/* PGxFFPCIL: PWM GENERATOR FEED FORWARD PCI REGISTER LOW
747
748
________________ BIT 15: TSYNCDIS: Termination Synchronization Disable
749
| _______________ BIT 14: TERM[2:0]: Termination Event Selection
750
|| ______________ BIT 13:
751
||| _____________ BIT 12:
752
|||| ____________ BIT 11: AQPS: Acceptance Qualifier Polarity Selection
753
||||| ___________ BIT 10: AQSS[2:0]: Acceptance Qualifier Source Selection
754
|||||| __________ BIT 9:
755
||||||| _________ BIT 8:
756
|||||||| ________ BIT 7: SWTERM: PCI Software Termination
757
||||||||| _______ BIT 6: PSYNC: PCI Synchronization Control
758
|||||||||| ______ BIT 5: PPS: PCI Polarity Selection
759
||||||||||| _____ BIT 4: PSS[4:0]: PCI Source Selection
760
|||||||||||| ____ BIT 3:
761
||||||||||||| ___ BIT 2:
762
|||||||||||||| __ BIT 1:
763
||||||||||||||| _ BIT 0:
764
|||||||||||||||| */
765
#define REG_PGxFFPCIL 0b0000000000000000
766
767
#define REG_PGxyPCILPC 0b0001000100000000
// Peak Current Mode Control Configuration (no PCI source selected)
768
#define REG_PGxyPCIHPC 0b0000001100011001
// Peak Current Mode Control Configuration
769
774
/*
775
776
________________ BIT 15: BPEN: PCI Bypass Enable
777
| _______________ BIT 14: BPSEL[2:0]: PCI Bypass Source Selection
778
|| ______________ BIT 13:
779
||| _____________ BIT 12:
780
|||| ____________ BIT 11: (unimplemented)
781
||||| ___________ BIT 10: ACP[2:0]: PCI Acceptance Criteria Selection
782
|||||| __________ BIT 9:
783
||||||| _________ BIT 8:
784
|||||||| ________ BIT 7: SWPCI: Software PCI Control
785
||||||||| _______ BIT 6: SWPCIM[1:0]: Software PCI Control Mode
786
|||||||||| ______ BIT 5:
787
||||||||||| _____ BIT 4: LATMOD: PCI SR Latch Mode
788
|||||||||||| ____ BIT 3: TQPS: Termination Qualifier Polarity Selection
789
||||||||||||| ___ BIT 2: TQSS[2:0]: Termination Qualifier Source Selection
790
|||||||||||||| __ BIT 1:
791
||||||||||||||| _ BIT 0:
792
|||||||||||||||| */
793
#define REG_PGxFFPCIH 0b0000000000000000
794
799
/* PGxSPCIL: PWM GENERATOR SOFTWARE PCI REGISTER LOW
800
801
________________ BIT 15: TSYNCDIS: Termination Synchronization Disable
802
| _______________ BIT 14: TERM[2:0]: Termination Event Selection
803
|| ______________ BIT 13:
804
||| _____________ BIT 12:
805
|||| ____________ BIT 11: AQPS: Acceptance Qualifier Polarity Selection
806
||||| ___________ BIT 10: AQSS[2:0]: Acceptance Qualifier Source Selection
807
|||||| __________ BIT 9:
808
||||||| _________ BIT 8:
809
|||||||| ________ BIT 7: SWTERM: PCI Software Termination
810
||||||||| _______ BIT 6: PSYNC: PCI Synchronization Control
811
|||||||||| ______ BIT 5: PPS: PCI Polarity Selection
812
||||||||||| _____ BIT 4: PSS[4:0]: PCI Source Selection
813
|||||||||||| ____ BIT 3:
814
||||||||||||| ___ BIT 2:
815
|||||||||||||| __ BIT 1:
816
||||||||||||||| _ BIT 0:
817
|||||||||||||||| */
818
#define REG_PGxSPCIL 0b0000000000000000
819
824
/*
825
826
________________ BIT 15: BPEN: PCI Bypass Enable
827
| _______________ BIT 14: BPSEL[2:0]: PCI Bypass Source Selection
828
|| ______________ BIT 13:
829
||| _____________ BIT 12:
830
|||| ____________ BIT 11: (unimplemented)
831
||||| ___________ BIT 10: ACP[2:0]: PCI Acceptance Criteria Selection
832
|||||| __________ BIT 9:
833
||||||| _________ BIT 8:
834
|||||||| ________ BIT 7: SWPCI: Software PCI Control
835
||||||||| _______ BIT 6: SWPCIM[1:0]: Software PCI Control Mode
836
|||||||||| ______ BIT 5:
837
||||||||||| _____ BIT 4: LATMOD: PCI SR Latch Mode
838
|||||||||||| ____ BIT 3: TQPS: Termination Qualifier Polarity Selection
839
||||||||||||| ___ BIT 2: TQSS[2:0]: Termination Qualifier Source Selection
840
|||||||||||||| __ BIT 1:
841
||||||||||||||| _ BIT 0:
842
|||||||||||||||| */
843
#define REG_PGxSPCIH 0b0000000000000000
844
849
/*
850
851
________________ BIT 15: (unimplemented)
852
| _______________ BIT 14: (unimplemented)
853
|| ______________ BIT 13: (unimplemented)
854
||| _____________ BIT 12: (unimplemented)
855
|||| ____________ BIT 11: (unimplemented)
856
||||| ___________ BIT 10: PWMPCI[2:0]: PWM Source for PCI Selection
857
|||||| __________ BIT 9:
858
||||||| _________ BIT 8:
859
|||||||| ________ BIT 7: (unimplemented)
860
||||||||| _______ BIT 6: (unimplemented)
861
|||||||||| ______ BIT 5: (unimplemented)
862
||||||||||| _____ BIT 4: (unimplemented)
863
|||||||||||| ____ BIT 3: PHR: PWMxH Rising Edge Trigger Enable
864
||||||||||||| ___ BIT 2: PHF: PWMxH Falling Edge Trigger Enable
865
|||||||||||||| __ BIT 1: PLR: PWMxL Rising Edge Trigger Enable
866
||||||||||||||| _ BIT 0: PLF: PWMxL Falling Edge Trigger Enable
867
|||||||||||||||| */
868
#define REG_PGxLEBH 0b0000000000001000
869
874
/* PGxLEBL: PWM GENERATOR x LEADING-EDGE BLANKING REGISTER LOW
875
876
________________ BIT 15: LEB[15:0]: Leading-Edge Blanking Period bits
877
| _______________ BIT 14:
878
|| ______________ BIT 13:
879
||| _____________ BIT 12:
880
|||| ____________ BIT 11:
881
||||| ___________ BIT 10:
882
|||||| __________ BIT 9:
883
||||||| _________ BIT 8:
884
|||||||| ________ BIT 7:
885
||||||||| _______ BIT 6:
886
|||||||||| ______ BIT 5:
887
||||||||||| _____ BIT 4:
888
|||||||||||| ____ BIT 3:
889
||||||||||||| ___ BIT 2:
890
|||||||||||||| __ BIT 1:
891
||||||||||||||| _ BIT 0:
892
|||||||||||||||| */
893
#define REG_PGxLEBL 0b0000000000000000
894
899
/*
900
901
________________ BIT 15: PGxDCA[15:0]: PWM Generator x Duty Cycle Adjustment Register
902
| _______________ BIT 14:
903
|| ______________ BIT 13:
904
||| _____________ BIT 12:
905
|||| ____________ BIT 11:
906
||||| ___________ BIT 10:
907
|||||| __________ BIT 9:
908
||||||| _________ BIT 8:
909
|||||||| ________ BIT 7:
910
||||||||| _______ BIT 6:
911
|||||||||| ______ BIT 5:
912
||||||||||| _____ BIT 4:
913
|||||||||||| ____ BIT 3:
914
||||||||||||| ___ BIT 2:
915
|||||||||||||| __ BIT 1:
916
||||||||||||||| _ BIT 0:
917
|||||||||||||||| */
918
#define REG_PGxDCA 0b0000000000000000
919
920
921
#endif
/* BUCK_CONVERTER_PERIPHERAL_CONFIGURATION_PWM_H */
922
dpsk_buck_pcmc.X
sources
power_control
devices
templates
dev_buck_ptemp_pwm.h
© 2021, Microchip Technology Inc.