![creating a sine wave in mplab xc8 creating a sine wave in mplab xc8](https://image.slidesharecdn.com/singlephasefullbridgeinverter-170830171812/95/slide-12-1024.jpg)
LED brightness can be adjusted using a pulse width modulated (PWM) signal, as shown, or by using a DC voltage to drive the I ADJ pin directly, without the R3/C3 low-pass filter. The circuit in Figure 129.7 is capable of driving six white LEDs from a single Li-Ion cell. With an input voltage range of 1.6V to 18V, the LT1618 can provide LED drive from a variety of input sources, including two or more alkaline cells, or one or more Li-Ion cells.
Creating a sine wave in mplab xc8 drivers#
White LED drivers are one such application for which the LT1618 is ideally suited. In addition to providing an accurate input current limit, the LT1618 can also be used to provide a regulated output current for current-source applications. A screen image of this simulation is shown in Figure 2. Note that the power circuit and the motor is simulated using a special simulator. It has been our experience that use of custom hardware significantly slows down simulation. Simulation runs about 7400 times slower than the actual system for the second implementation, showing the effect of Verilog-XL on simulation time.
Creating a sine wave in mplab xc8 code#
The controller of Figure 4(c) can be implemented with only 200 lines of C code while the custom circuit is represented using 100 lines of behavioral-level Verilog. The controller of Figure 4(b), can be implemented in 600 lines of C code and simulation runs about a factor of 3200 slower than the actual system. This is a good example of how the co-simulator may be used to determine hardware-software trade-offs at the implementation level. The amount of ROM required to store the program and the tables is also smaller. The demodulated waveforms now show a mean square error of less than 1% from an ideal sine wave at all frequencies. The calculation for pulse width modulation are still performed in the processor but the actual generation of the signals is moved to custom hardware. An alternative architecture is shown in Figure 4(c) where some custom circuitry is used in conjunction with the microprocessor. At high frequencies, the demodulated waveforms show a mean square error of 8% from an ideal sine wave because the processor cannot keep up with the required rate of calculation. All computation required to produce the pulse width modulated signals is performed in the microprocessor.
![creating a sine wave in mplab xc8 creating a sine wave in mplab xc8](https://img.electronicdesign.com/files/base/ebm/electronicdesign/image/2020/09/PROMO_TI_237024.5f6cbb44ca120.png)
3-phase motor controller (a) block diagram (b) first and (c) second implementationĪn implementation of this controller using a microprocessor and standard peripherals is shown in Figure 4(b).