[Menu]>[Circuits Gallery]>[Light controller]
Control voltage wave form observation
The output wave forms with the 1st program are shown below.
Some cause that the falling edge becomes gentle can be assumed. I think that the OFF characteristic of the FET is a prime factor. When referring to the data sheet, you can find that the turn-off delay time of 2SJ471 is approximately 10 times the turn-on delay time in case of no-load.
I will show the wave forms of each point at VR=50% below.
The voltage of the B point is reversed by TR1.
The size of wave from of A point is adjusted to make it easy to watch.
I will show a output wave after improvement below.
Because the period of the control pulse became long, the FET electricity consumption was improved.
The change part of the software is the prescaler set value of timer2. I changed it to 1:16.
The set value of timer2 should not be changed. When having changed this value, the output of PWM has always become H level before becoming the maximum (255) of the A/D converter.
I didn't change taking-in period (1mS) with voltage by the variable resistor.
The A/D converted value is set to the CCPR1L register. The value is used in PWM control of the next period. There is no problem even if CCPR1L register is rewritten more than one time before PWM control is done.