search.noResults

search.searching

dataCollection.invalidEmail
note.createNoteMessage

search.noResults

search.searching

orderForm.title

orderForm.productCode
orderForm.description
orderForm.quantity
orderForm.itemPrice
orderForm.price
orderForm.totalPrice
orderForm.deliveryDetails.billingAddress
orderForm.deliveryDetails.deliveryAddress
orderForm.noItems
FEATURE MCUS PWM MODULES: the benefits


Willem J Smit, from Microchip Technology, explains how to use the advanced, high-precision PWM modules found on some microcontrollers


he PWM modules on some microcontrollers contain innovative features for use in power supplies, LED lighting, colour mixing and motor control applications, where they let the user easily vary the phase, duty cycle and offset event count with greater precision. And via the offset modes, each PWM output can offset its waveform relative to any other PWM module on the same device.


T


ADDITIONAL TIMERS When not using the PWM outputs on these high-precision 16bit PWM modules, such as found on some Microchip PIC16 microcontrollers, they can be used to add up to four additional general-purpose 16bit timers. Each PWM module can have its timer


independently clocked via a selection of three sources. In addition, the PWM clock source can be divided down with seven selectable prescalers to suit the user’s needs better. The timer value can then be compared


with event count registers to generate a multitude of PWM waveforms. Four 16bit count registers are available to manipulate the phase, duty cycle, period and offset, see Figure 1 (above).


PWM MODES Each PWM module has four selectable modes of operation – standard, set-on- match, toggle-on-match and centre aligned.


The standard mode produces a single- phase PWM waveform, which is constructed by comparing and matching the PWM counter value with the 16bit phase, period and duty cycle registers. Upon a match of the phase count register, the start of the duty cycle begins. The end of the duty cycle occurs upon a match of the duty cycle count register.


The set-on-match mode generates an output when the phase count register matches the PWM timer. This output will remain active until the out bit is cleared or the PWM module is disabled. The toggle-on-match mode produces a 50% duty cycle PWM waveform with a period twice as long as that of the


14 JUNE 2017 | ELECTRONICS


standard PWM mode. The phase count registers determine how many PWM timer periods after a period event before the PWM waveform will toggle. The centre-aligned mode generates a


PWM waveform that is centred on the PWM period. The period is twice that of the PWMxPR count registers. In this mode, the PWM timer will count until a match is met with the PWMxPR registers and then count back down to a value match of 0. The active rising and falling edge of the PWM waveform is determined by the duty cycle count registers.


Figure 1: 16bit PWM block diagram


modules. In this mode, the PWM will continually run while enabled, see Figure. 2 (below).


OFFSET MODE


In addition to these PWM modes, each PWM module also has four offset modes that can offset its waveform relative to any other PWM module. The modes are: independent run; slave run with synchronous start; one-shot slave with synchronous start; and continuous run slave with synchronous start and timer reset. In independent run mode, the PWM offset, phase, duty cycle and period are not affected by any of the other PWM


Figure 2: Independent run mode timing diagram


Figure 3: Continuous run slave with synchronous start and timer reset


SYNCHRONOUS START MODE In slave run with synchronous start mode, it is necessary to have at least two or more PWM modules active, allowing for a master-slave pair. In this mode, the slave will wait until the offset event of the master is matched to begin counting and will continue counting as long as it remains enabled. Much like the slave run with synchronous start mode, the one-shot slave with synchronous start mode also requires more than one PWM active, with one being master and the other slave. In this mode, the timer begins counting, starting with a pre-configured value already in the timer and does so until the period match event. The PWM timer then waits for a match with the master offset value before repeating the cycle. In the continuous run slave with synchronous start and timer reset mode, the slave PWM timer does not start counting until the first match of the master offset event. Subsequent master offset match events will then reset the slave PWM timer value back to 1, after which it will continue counting, see Figure. 3 (left).


CONCLUSION As we have shown, the high-precision 16bit PWM available in various Microchip PIC16 devices, such as the PIC16F1574, delivers advanced features beyond those found on standard PWM modules.


Microchip www.microchip.com T: +1 (480) 792 7200


/ ELECTRONICS


Page 1  |  Page 2  |  Page 3  |  Page 4  |  Page 5  |  Page 6  |  Page 7  |  Page 8  |  Page 9  |  Page 10  |  Page 11  |  Page 12  |  Page 13  |  Page 14  |  Page 15  |  Page 16  |  Page 17  |  Page 18  |  Page 19  |  Page 20  |  Page 21  |  Page 22  |  Page 23  |  Page 24  |  Page 25  |  Page 26  |  Page 27  |  Page 28  |  Page 29  |  Page 30  |  Page 31  |  Page 32  |  Page 33  |  Page 34  |  Page 35  |  Page 36  |  Page 37  |  Page 38  |  Page 39  |  Page 40  |  Page 41  |  Page 42  |  Page 43  |  Page 44  |  Page 45  |  Page 46  |  Page 47  |  Page 48  |  Page 49  |  Page 50  |  Page 51  |  Page 52  |  Page 53  |  Page 54  |  Page 55  |  Page 56