Bar Logo 3.8/7.6 kw Totem pole Demonstration Application (Part-No. (not specified))
 
Content
     
Loading...
Searching...
No Matches
MCC_add_on.h
1/*
2© [2024] Microchip Technology Inc. and its subsidiaries.
3
4 Subject to your compliance with these terms, you may use Microchip
5 software and any derivatives exclusively with Microchip products.
6 You are responsible for complying with 3rd party license terms
7 applicable to your use of 3rd party software (including open source
8 software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
9 NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
10 SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
11 MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
12 WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
13 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
14 KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
15 MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
16 FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
17 TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
18 EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
19 THIS SOFTWARE.
20*/
21
22#ifndef MCC_ADD_ON_H
23#define MCC_ADD_ON_H
24
25/*
26 Section: Included Files
27*/
28
29#include <xc.h>
30
42typedef enum
43{
44 PWM_GENERATOR_1 = 1,
45 PWM_GENERATOR_2 = 2,
46 PWM_GENERATOR_3 = 3,
48
49
50
69inline static void PWM_SwapEnable(PWM_GENERATOR genNum)
70{
71 switch(genNum) {
72 case PWM_GENERATOR_1:
73 PG1IOCONLbits.SWAP = 1;
74 break;
75 case PWM_GENERATOR_2:
76 PG2IOCONLbits.SWAP = 1;
77 break;
78 case PWM_GENERATOR_3:
79 PG3IOCONLbits.SWAP = 1;
80 break;
81 default:break;
82 }
83}
84
103inline static void PWM_SwapDisable(PWM_GENERATOR genNum)
104{
105 switch(genNum) {
106 case PWM_GENERATOR_1:
107 PG1IOCONLbits.SWAP = 0;
108 break;
109 case PWM_GENERATOR_2:
110 PG2IOCONLbits.SWAP = 0;
111 break;
112 case PWM_GENERATOR_3:
113 PG3IOCONLbits.SWAP = 0;
114 break;
115 default:break;
116 }
117}
118
143inline static void PWM_DeadTimeLowSet(PWM_GENERATOR genNum,uint16_t deadtimeLow)
144{
145 switch(genNum) {
146 case PWM_GENERATOR_1:
147 PG1DTL = deadtimeLow;
148 break;
149 case PWM_GENERATOR_2:
150 PG2DTL = deadtimeLow;
151 break;
152 case PWM_GENERATOR_3:
153 PG3DTL = deadtimeLow;
154 break;
155 default:break;
156 }
157}
158
183inline static void PWM_DeadTimeHighSet(PWM_GENERATOR genNum,uint16_t deadtimeHigh)
184{
185 switch(genNum) {
186 case PWM_GENERATOR_1:
187 PG1DTH = deadtimeHigh;
188 break;
189 case PWM_GENERATOR_2:
190 PG2DTH = deadtimeHigh;
191 break;
192 case PWM_GENERATOR_3:
193 PG3DTH = deadtimeHigh;
194 break;
195 default:break;
196 }
197}
198
217inline static void PWM_GeneratorEnable(PWM_GENERATOR genNum)
218{
219 switch(genNum) {
220 case PWM_GENERATOR_1:
221 PG1CONLbits.ON = 1;
222 break;
223 case PWM_GENERATOR_2:
224 PG2CONLbits.ON = 1;
225 break;
226 case PWM_GENERATOR_3:
227 PG3CONLbits.ON = 1;
228 break;
229 default:break;
230 }
231}
232
252inline static void PWM_OverrideHighEnable(PWM_GENERATOR genNum)
253{
254 switch(genNum) {
255 case PWM_GENERATOR_1:
256 PG1IOCONLbits.OVRENH = 1;
257 break;
258 case PWM_GENERATOR_2:
259 PG2IOCONLbits.OVRENH = 1;
260 break;
261 case PWM_GENERATOR_3:
262 PG3IOCONLbits.OVRENH = 1;
263 break;
264 default:break;
265 }
266}
267
287inline static void PWM_OverrideLowEnable(PWM_GENERATOR genNum)
288{
289 switch(genNum) {
290 case PWM_GENERATOR_1:
291 PG1IOCONLbits.OVRENL = 1;
292 break;
293 case PWM_GENERATOR_2:
294 PG2IOCONLbits.OVRENL = 1;
295 break;
296 case PWM_GENERATOR_3:
297 PG3IOCONLbits.OVRENL = 1;
298 break;
299 default:break;
300 }
301}
302
325inline static void PWM_DutyCycleSet(PWM_GENERATOR genNum,uint16_t dutyCycle)
326{
327 switch(genNum) {
328 case PWM_GENERATOR_1:
329 PG1DC = dutyCycle;
330 break;
331 case PWM_GENERATOR_2:
332 PG2DC = dutyCycle;
333 break;
334 case PWM_GENERATOR_3:
335 PG3DC = dutyCycle;
336 break;
337 default:break;
338 }
339}
340
361inline static void PWM_OverrideHighDisable(PWM_GENERATOR genNum)
362{
363 switch(genNum) {
364 case PWM_GENERATOR_1:
365 PG1IOCONLbits.OVRENH = 0;
366 break;
367 case PWM_GENERATOR_2:
368 PG2IOCONLbits.OVRENH = 0;
369 break;
370 case PWM_GENERATOR_3:
371 PG3IOCONLbits.OVRENH = 0;
372 break;
373 default:break;
374 }
375}
376
396inline static void PWM_OverrideLowDisable(PWM_GENERATOR genNum)
397{
398 switch(genNum) {
399 case PWM_GENERATOR_1:
400 PG1IOCONLbits.OVRENL = 0;
401 break;
402 case PWM_GENERATOR_2:
403 PG2IOCONLbits.OVRENL = 0;
404 break;
405 case PWM_GENERATOR_3:
406 PG3IOCONLbits.OVRENL = 0;
407 break;
408 default:break;
409 }
410}
411
412
413#endif /* MCC_ADD_ON_H */
414
@ PWM_GENERATOR_1
@ PWM_GENERATOR_2
PWM_GENERATOR
Defines the PWM generators that are selected from the MCC Melody User Interface for the PWM output co...