Thursday, September 30, 2010

  
This flasher moves, while lighting of LED drags on. The brightness of LED is four kinds, bright, less bright, almost dim and dim. These lighting states are moved with time. Control of brightness is performed in lighting time of LED like PWM(Pulse Width Modulation). There is no PWM function in PIC16F84A. Therefore, I divided lighting of LED into four cycles, and controlled them. It is "Bright" when all periodic lightings are carried out. 2 cycle lighting state is "Less bright". 1 cycle lighting state is "almost dim". It is "Dim" in OFF a total cycle. At first, I was going to prepare much more cycles. However, because PIC16F84A carried only 1K-word program memory, I made into four cycles.
   The timer function of PIC is used for the processing which moves the lighting position of LED. When man looks at the lighting situation of LED, it is not meaningful if too quick. In this circuit, it is the purpose to show so that lighting of LED may drag on. In order to lengthen time of a timer, 4MHz resonator is used. The period with 4MHz frequency is 1/4,000,000 = 0.25 microseconds. Because 4 periods (the clock) are necessary to the count of the timer, a count is downed with the timer every microsecond. Because a prescaler of 1/256 is used for the input of timer, actually, a count is downed with every 256 microseconds. When making the initial value of the timer as 195, the time-out becomes 256µsec/count x 195count = 49920µsec = 50msec.
 

No comments:

Post a Comment