07-06-2012, 04:40 PM
LED BRIGHTNESS CONTROLLING USING SERIAL PORT
LED brightness.pptx (Size: 231.18 KB / Downloads: 0)
Interfacing with pc
Interfacing is done using RS232 DS-9 port which is connected to pc & microcontroller.
On port 3,at p3.0 & p3.1 the input signal is received.
TXD,RXD pins are also used in interfacing.
Sending signals from pc
To send signals from pc we need to make a software using vb .net .This signals will vary from 0 to 255.As per this signals the PWM will vary by duty cycle in microcontroller, resulting in a change in LED brighness.
Thus we can get 0 to 255 levels of brighness.
PWM
By varying (or ‘modulating’) the pulsing width we can effectively control the light output from the LED, hence the term PWM or Pulse Width Modulation.
The minimum speed of an LED oscillating which can be seen by the human eye varies from person to person. However, for the purposes of this article, we will use a minimum speed of 50Hz, or 50 times per second (the same speed as used by European televisions).
PWM resolution
The accuracy with which we can control the duty-cycle is known as the ‘PWM resolution’. The higher our PWM resolution is, the more levels of ‘brightness’ we can display.
Overall the ‘PWM resolution’ dictates the number of brightness ‘levels’ we can support between completely off (0%) and completely on (100%). Again, the higher the resolution, the more timing accuracy and processing overhead is required.
Timing the interrupt
To perform the PWM using an interrupt we have to call the interrupt and decide if the LED should be on or off. To do this we have to set up a timer on the microcontroller which calls the interrupt when it expires.