go_away

Author Topic: Problem with ADC  (Read 2312 times)

0 Members and 1 Guest are viewing this topic.

Offline neo01124Topic starter

  • Jr. Member
  • **
  • Posts: 46
  • Helpful? 0
Problem with ADC
« on: February 08, 2008, 09:09:32 AM »
We are trying to interface IR sensor with the uC  through ADC0808.
XTAL frequency of uC is 11.0592 MHz. So to reduce it to be able to use the same XTAL for ADC clock we have used 74LS74 (D flip-flops).

The program which we have burned into the uC is as follows:

// for uC take input (from ADC) at P1, output it at P3, use P2 for special ADC pins

#include<reg51.H>
sbit ALE=P2^4;
sbit OE=P2^5;
sbit SC=P2^6;
sbit EOC=P2^7;
sbit ADDR_A=P2^0;
sbit ADDR_B=P2^1;
sbit ADDR_C=P2^2;
void main()
{
   unsigned char value;
   unsigned char i;
   P1=0xFF;        //input
   P3=0x00;               //output
   EOC=1;
   ALE=0;
   OE=0;
   SC=0;
   while(1)
   {
      ADDR_C=0;
      ADDR_B=0;
      ADDR_A=1;
      for(i=0;i<1000;i++);
      ALE=1;
      for(i=0;i<1000;i++);
      SC=1;
      for(i=0;i<1000;i++);
      ALE=0;
      SC=0;
      while(EOC==1);
      while(EOC==0);
      OE=1;
      for(i=0;i<1000;i++);
      value=P1;
      OE=0;
      P3=value;
   }
}

The problem is that whatever be the input to the ADC, the uC shows zero at all pins on P3.
I dont know if there is any error in my electrical circuit or the programming part.
Any help will be of great value.

Offline neo01124Topic starter

  • Jr. Member
  • **
  • Posts: 46
  • Helpful? 0
Re: Problem with ADC
« Reply #1 on: February 10, 2008, 07:21:28 AM »
We've used 4 D-Flip Flops which make d clock frequency 1\16th(each reducing it to half) which comes out to be 691.2 KHz. The maximum allowed frequency is 640 KHz. Can this be a reason for non-working of d ADC?

Pls reply soon.
Plz.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,666
  • Helpful? 169
    • Society of Robots
Re: Problem with ADC
« Reply #2 on: February 11, 2008, 02:48:47 PM »
Quote
The problem is that whatever be the input to the ADC, the uC shows zero at all pins on P3.

http://www.societyofrobots.com/robot_faq.shtml#circuit_debug

(you never mentioned checking pins with a multimeter)

Offline neo01124Topic starter

  • Jr. Member
  • **
  • Posts: 46
  • Helpful? 0
Re: Problem with ADC
« Reply #3 on: February 11, 2008, 03:13:59 PM »
Always try this debugging before posting here.
Neways could u suggest any way of testing the d flip flop circuit without a proper oscilloscope..?

Moreover could u tell me what exactly a xtal does i.e. how does it give the uC a sense of timing?

Why does the ADC have only one clock pin instead of an xtal1 and xtal2 like on a uC?

Can we give a simple PWM of the same frequency(640mhz 50% duty cycle) to the clock pin of the ADC?

My basic electronics is pretty weak as u can seee ???

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,666
  • Helpful? 169
    • Society of Robots
Re: Problem with ADC
« Reply #4 on: February 11, 2008, 03:22:03 PM »
Quote
Why does the ADC have only one clock pin instead of an xtal1 and xtal2 like on a uC?
Sounds like you don't have it wired properly . . . you send a clock signal to a clock pin, such as from your ATmega16. There will be a pin on your mcu that outputs the clock. This allows both clocks to be synchronized.

Offline Rebelgium

  • Supreme Robot
  • *****
  • Posts: 638
  • Helpful? 0
  • It's called the future ... We like it here
Re: Problem with ADC
« Reply #5 on: February 15, 2008, 12:41:41 PM »
Moreover could u tell me what exactly a xtal does i.e. how does it give the uC a sense of timing?
My basic electronics is pretty weak as u can seee ???

wikipedia.com
google.com
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

 


Get Your Ad Here

data_list