| Author |
Message |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
22 Jun 2009 7:22 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?
|
|
| Back to top |
|
 |
aanand_44
Joined: 25 Jul 2007 Posts: 24 Helped: 2 Location: India
|
22 Jun 2009 9:53 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
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
22 Jun 2009 10:00 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
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
22 Jun 2009 10:06 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
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
22 Jun 2009 12:40 i am doing ADC |
|
|
|
|
| You want someone to write your homework code for you?
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
22 Jun 2009 15:51 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?
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
23 Jun 2009 3:37 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
|
|
| Back to top |
|
 |
mfarooq1
Joined: 09 Jan 2009 Posts: 87 Helped: 4
|
23 Jun 2009 11:54 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
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
23 Jun 2009 15:59 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?
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
23 Jun 2009 17:54 i am doing ADC |
|
|
|
|
| When's it due?
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
23 Jun 2009 18:44 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
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
23 Jun 2009 20:20 i am doing ADC |
|
|
|
|
| Perhaps you should try something simpler for your first project. Flashing an LED is good.
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
24 Jun 2009 1:54 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..
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
30 Jun 2009 2:50 Re: i am doing ADC |
|
|
|
|
| help help mi..
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
30 Jun 2009 3:44 Re: i am doing ADC |
|
|
|
|
| jason1987 wrote: |
| help help mi.. |
Sounds like a line from the Beatles song.
Your attached file C8051F2xx.pdf is nothing more than the datasheet.
Last edited by blueroomelectronics on 30 Jun 2009 3:47; edited 1 time in total |
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
30 Jun 2009 3:47 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
}
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
30 Jun 2009 3:48 i am doing ADC |
|
|
|
|
Where did you get the code?
Try running it.
When's it due?
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
30 Jun 2009 3:53 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?
|
|
| Back to top |
|
 |
Google AdSense

|
30 Jun 2009 3:53 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
30 Jun 2009 4:09 i am doing ADC |
|
|
|
|
| Where did you get the code from?
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
30 Jun 2009 4:10 Re: i am doing ADC |
|
|
|
|
| from my teacher.. i need to understand.. give some guide
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
30 Jun 2009 4:12 i am doing ADC |
|
|
|
|
| Then why not ask your teacher to explain it.
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
30 Jun 2009 4:14 Re: i am doing ADC |
|
|
|
|
| thank for the replying mi, if he will explain to mi den i post here for what?
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
30 Jun 2009 4:19 i am doing ADC |
|
|
|
|
The comments in the code tell what the code is doing.
Your teacher gave this to you to debug so you could learn to program.
Do you not know how to program in C ?
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
30 Jun 2009 4:22 Re: i am doing ADC |
|
|
|
|
i dunno hw to program in C.. and i have a hex file.. how to download to the board using silicon software? what kind of result if i download the code to ther board? and kinda tell mi the code what he is doin?
#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
}
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
30 Jun 2009 4:27 i am doing ADC |
|
|
|
|
You have to compile the code first. Makes no sense your teacher would expect you to be able to understand the code if you can't program in C
I recommend a getting a book on C
PS what does "mi" mean?
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
30 Jun 2009 4:29 Re: i am doing ADC |
|
|
|
|
| but do u noe what the code is doing anot? if i have the book i wont be posting here
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
30 Jun 2009 4:33 Re: i am doing ADC |
|
|
|
|
| jason1987 wrote: |
| but do u noe what the code is doing anot? if i have the book i wont be posting here |
Sorry I don't understand your question?
As for the book why do you want to post it? I don't need a C book I have a couple.
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
30 Jun 2009 4:38 Re: i am doing ADC |
|
|
|
|
| i don't undestand the code that why i post here for help.. i don't have the book tat why if u know try to help mi.. thank
|
|
| Back to top |
|
 |
blueroomelectronics
Joined: 17 Sep 2006 Posts: 1681 Helped: 99 Location: Toronto, Canada
|
30 Jun 2009 4:47 i am doing ADC |
|
|
|
|
| Try Google for C tutorials. The code is pretty straight forward. Don't bother with C# tutorials just look for ANSI C
|
|
| Back to top |
|
 |
jason1987
Joined: 22 Jun 2009 Posts: 69 Location: japan
|
30 Jun 2009 5:35 Re: i am doing ADC |
|
|
|
|
| give mi the link
|
|
| Back to top |
|
 |