Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 28th January 2008, 09:09 AM   (permalink)
Smile Adc 0808

Hi all,

After so much time i am using ADC0808 again in one of the tasks...


The algorithm i am following is this:

Quote:

• Select an analog channel by provide bits to A, B, C.
• Activate ALE with a low-to-high pulse.
• Activate SC with a high-to-low pulse (start conversion) The conversion is begun on the falling edge of the start conversion pulse. you can use circuit like

• Monitor EOC Pin .After conversion this pin goes high.
• Activate OE with a high-to-low pulse to read data out of the ADC chip.
Please suggest why the output from ADC is not received...

Regards,

Simran..
__________________
Simran..
8051 Specialist..

Last edited by simrantogether; 28th January 2008 at 10:12 AM.
simrantogether is offline  
Old 28th January 2008, 10:13 AM   (permalink)
Smile C Program...

Hi,

This is the code i designed from that algorithm...

Code:
#include<reg51.h>

sbit A0 		   = P0^0;
sbit A1			   = P0^1;
sbit A2 		   = P0^2;
sbit ADC_ALE		= P0^3;
sbit ADC_OE 		= P0^4;
sbit ADC_EOC 		= P0^5;
sbit ADC_START 	       = P0^7;

void msdelay(unsigned int);

void main(void)

{

while(1)
{

P0 = 0x00; // making all the bits of ports as 0

A0 = 1;
A1 = 1;
A2 = 1;	// Selecting input channel 7 by putting A1 , A2 and A3 = 1

ADC_ALE = 0;

msdelay(50);

ADC_ALE =1;		// this address of analog channel is latched with rising edge of ALE

msdelay(50);

ADC_START = 1;

msdelay(50);

ADC_START = 0;  // falling edge of ADC_START atarts the conversion of ADC


msdelay(50);	

	if(ADC_EOC = 1)
	{

	ADC_OE = 1;

	msdelay(50);

	ADC_OE = 0;

	msdelay(50);
	}

}
}





//----------------------------- Delay Routine ---------------------


void msdelay(unsigned int i)
{

unsigned int j,k;

 for(j=1; j<=i;j++)
 {
 	for(k=1;k<=1275;k++)
 	{
 	}
 	
 }

}
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Old 28th January 2008, 01:22 PM   (permalink)
Smile If anyone...

Hi,

If anyone has algorithm for ADC 0808 interfacing with a micro controller ...

please tell...

Or,

Please check my upper algorithm...

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Old 28th January 2008, 03:00 PM   (permalink)
Default

Your code looks fine, however, you don't appear to have the data lines connected to your processor. When you set OE high, the converted value appears on D0-D7 and you need to connect them to a port and read them.

Mike.
Pommie is online now  
Old 29th January 2008, 05:51 AM   (permalink)
Smile Well...

Quote:
Originally Posted by Pommie
Your code looks fine, however, you don't appear to have the data lines connected to your processor. When you set OE high, the converted value appears on D0-D7 and you need to connect them to a port and read them.

Mike.
Actually i interfaced the output of ADC with the LED's ...

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Old 29th January 2008, 10:49 AM   (permalink)
Default

I don't think the outputs from the ADC0808 are able to directly drive LEDs.

Mike.
Pommie is online now  
Old 29th January 2008, 12:41 PM   (permalink)
Smile Yes...

Hi,

Yes they can...

because i used uln2803 between ADC and LED's...

Problem i find is with Code i feel...

Please check the algorithm...

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Old 29th January 2008, 01:08 PM   (permalink)
Default

You are not waiting for the conversion to complete.

Try,
Code:
void main(void){
    while(1){    
        P0 = 0x00;         // making all the bits of ports as 0    
        A0 = 1;
        A1 = 1;
        A2 = 1;	           // Selecting input channel 7 by putting A1 , A2 and A3 = 1    
        ADC_ALE = 0;    
        msdelay(50);    
        ADC_ALE =1;        // this address of analog channel is latched with rising edge of ALE    
        msdelay(50);    
        ADC_START = 1;    
        msdelay(50);    
        ADC_START = 0;      // falling edge of ADC_START atarts the conversion of ADC    
        msdelay(50);	
        while(ADC_EOC!=1);  //wait for conversion to end    
        ADC_OE = 1;
        msdelay(500);       //allow time for LEDs to be viewed.
        ADC_OE = 0;
    }
}
Mike.
Pommie is online now  
Old 29th January 2008, 01:21 PM   (permalink)
Smile

Quote:
Originally Posted by Pommie
You are not waiting for the conversion to complete.

Try ....

Mike.

Thanks...

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
PIC12F675 ADC Circuit help. MERV Micro Controllers 4 16th January 2008 09:06 PM
ADC troubles andy257 General Electronics Chat 4 2nd December 2007 06:49 PM
Analog to Digital Converter (ADC) simonmada Electronic Projects Design/Ideas/Reviews 15 15th November 2007 04:31 AM
HS1101 capacitive humidity sensor; need nearly linear voltage to feed to a 1-wire ADC FirefighterBlu3 Electronic Projects Design/Ideas/Reviews 5 20th October 2007 12:06 AM
16F877 Timer0 Interrupt Affecting ADC sebana Micro Controllers 13 12th September 2007 10:43 AM



All times are GMT. The time now is 03:27 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker