Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Max 118 Adc

Status
Not open for further replies.

niraj_khandekar

New Member
hey guys, im working on this robotics project and im having sme problem with ma ADC.. they microcontroller when works fine and gives correct voltage at all the ports without the adc attached.. bt when i insert da ADc, all the ports go high showing 5 volts.. from what i interpretted from the datasheet, the conversion starts when WR goes frm high to low. (MODE 1). 4 bits are latchd, next four bits conv starts when wr goes frm low to high. int goes low when conv is finished. send low signal to rd for to access the data. ive programmed the controller accordingly, bt it doesnt seem to work.
plz help me out..
thanx..
 
Why not just use a modern micro-controller with ADC built-in?.

If it doesn't work, then you probably haven't programmed your micro-controller correctly, but you haven't even mentioned what controller it might be, never mind posted the source code.
 
We are familiar with using P89V51RD2 Philips 8051 micro controller, and it does not have a built in adc. So we need to use an external ADC.

status of control pins are as follows:
chip select , cs=gnd;
mod = vcc;(write-read mode)
power down, pwrdwn=vcc;

We used the following prog to interface the microcontroller wit our adc:

#include <P89V51RD2.h>
#define adc_port P2 //ADC Port
#define rd P3_5 //Read signal P1.0
#define wr P3_4 //Write signal P1.1
#define intr P3_6 //INTR signal P1.3
#define ref 0x0f
#define led P3_7
#define a0 P3_0
#define a1 P3_1
#define a2 P3_2

void conv(); //Start of conversion function
void read(); //Read ADC function

unsigned short int adc_val;

void main()
{

a0 = 0;
a1 = 1;
a2 = 1;
wr = 1;
rd = 1;
while(1){ //Forever loop
conv(); //Start conversion
read(); //Read ADC
if (adc_val>ref)
led = 1;
}
}

void conv(){

wr = 0;
wr = 1;

while(intr); //Wait for INTR to go low
}

void read(){
//Make CS low
rd = 0; //Make RD low
adc_val = adc_port; //Read ADC port
rd = 1; //Make RD high

}

 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top