Using ADC n PWM to light up the LED dimmer - need help

Status
Not open for further replies.

jason1987

Member level 4
Joined
Jun 22, 2009
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
japan
Activity points
1,745
i am doing ADC

i nid help in ADC n PWM.. my project is to make the LED dimmer using ADC n PWM.. isit possible?
 

Re: i am doing ADC

Hi,
It is possible. which controller you are going to use this project?

U can modify the your duty cycle wit reference to ADC value.

Give me details I'll give u solution.

Regards,
Anand.A
 

    jason1987

    Points: 2
    Helpful Answer Positive Rating
Re: i am doing ADC

using ADC n PWM to light up the LED dimmer.. i using c8051f226dk.. give mi solution... erm i using microcontroller 8051 IC chip.. i gt the attachment help mi. and i attach to PDF file take a look
 

Re: i am doing ADC

i gt the board sample oso.. is attach to tis.. take a look ba.. i dunno anyting abt tis.. help
 

Re: i am doing ADC

if possible give mi the code i will study myself or i ask some question..cos i have no idea... if possible if cannot den jus teach mi will do..

a)my procedures is develop firmware for ADC to acquire potentiometer setting
b)develop firmware for PWM generation
c)integrate ADC acquistion for PWM generation
d) develop current driver circuit for LED.. any idea? can help to slove?
 

Re: i am doing ADC

can help mi? i jus wan some guide n i will learn myself.. jus give mi some hint will do.. den i learn myself.. i have a variable resister also and i dunno put where or connect where?

Added after 54 minutes:

can someone guide mi and give some hint.. i need urgent.. i need guide
 

Re: i am doing ADC

Hi
see the circuit in PDF and design in orcad. you can see the ADC connection with MCU and variable resistor. feel free to ask questions

Added after 58 seconds:

ADC circuit and Design in OrCad
 

    jason1987

    Points: 2
    Helpful Answer Positive Rating
Re: i am doing ADC

erm hw to do the program using ADC n PWM to generate the LEd dimmer? using c8051f226dk. hw does it wrk? tel mi more and the code i wanted dunno correct anot.. u have the datasheet rite? den can help mi? if possible i give u wat i have type and let u take a look?
 

Re: i am doing ADC

thank for replying mi. next week monday.. can help mi ma? i need it urgent because i have no idea what to do also.. cos first time handle this project.. thank.

best regard
 

i am doing ADC

Perhaps you should try something simpler for your first project. Flashing an LED is good.
 

    jason1987

    Points: 2
    Helpful Answer Positive Rating
Re: i am doing ADC

i alreadi start the flashing the LED wish can work. and now i wan go another steps which is going to do ADC but i don't have any idea about ADC.. so can give some guide? following is my PDF file name.. is my data sheet and kinda help mi abit. thank for replying mi..
 

Re: i am doing ADC

i am doing ADC and PWM to generate a LED dim.. anyone can help mi? urgent

what does the below code do?


#include<c8051f200.h>




//definitions
sbit LED = P2^4;


void adc_init(); //to initialize adc
void port_init(); //to initialize the ports

void main()
{

unsigned int index=0, total_period= (unsigned int) 255*256, on_time=0;
port_init();
adc_init();


// disable watchdog timer
WDTCN = 0xde;
WDTCN = 0xad;


{
ADBUSY = 0x01; //starts the adc conversion
while(ADCINT); //polling for ADCINT which tells us the end of conversion
ADCINT = 0x00;
on_time = ((unsigned int)ADC0H)*256;
for ( index = 0 ; index < total_period ; index++)
{
if (on_time--)
{
LED = 0x01; //switching on the LED

}

else
{
LED = 0x00; //switching off the LED
}
}
}
}

void adc_init ()

{
AMX0SL = 0x3f; // enable AMUX & configure for p3.7 as i/p pin
ADC0CF = 0x60; // set conversion clk at one sys clk and PGA at gain =1
ADC0CN = 0xC0; // ADC is enabled and ADBUSY=0 (changed here)
REF0CN = 0x03; // VDD is selected as Vref. Here are you using VDD for variable resistor also?
}
void port_init()
{
P3MODE = 0X7F; // Except the P3.7 pin all are configured as digital I/O
}
 

Re: i am doing ADC

i run the code but nothing happen.. hw come? and i have connect mine variable resistor to the ADC input but nothing happen.. y? any idea? what does the code do?
 

Re: i am doing ADC

from my teacher.. i need to understand.. give some guide
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…