-->

ADC 0804 Interfacing with 8051

By

 ADC 0804

ADC 0804 is an 8 bit parallel out and a single channel (ie only one analog input can be given)
First we need to learn the Pin details of the ADC .

CS:- This is an active low input pin. When this pin is at LOW logic level (i,e logic 0),ADC0804    is ready to operate.

WR:-This is an active low input pin. A LOW-to-HIGH pulse at this pin tells the ADC to start the conversion of applied analog input signal.

INTR:
- This is an active low output pin to indicate the end of conversion.

RD:- This is an active low input pin.After the end of conversion the converted digital signal is stored in the internal register of ADC0804 chip. Before the data is lost it is required to read the digital data from those internal register. By sending a HIGH-to-LOW pulse at this pin, we can read the digital data through 8-bit parallel pins of ADC0804.

CLK IN:- This is an input pin to provide a clock source to ADC0804 required for conversion when an external clock source is used.

CLK R:- To use on chip clock generator of ADC0804, the CLK IN and CLK R pins needs to be connected with RC circuit as shown in figure below.


The suitable value of R and C used in the circuitry is 10k and 150pF respectively. But its not any hard rule to use the same value of R and C. You can use any value of R and C which can generate approximately 110us of conversion time.



Vin :- These (Vin+ and Vin-) are the pin where you apply differential analog input from any sensor.



Vref/2:- This is the reference voltage pin. If this pin is left not connected then the reference voltage will automatically become 5V. But for application where you require reference voltage to be less then 5V, an external source of appropirate voltage should be connected to this pin. An voltage divider circuit can be used to obtain the required reference voltage by utilizing the same power source which microcontroller and ADC0804 are using. Now, for example you require a reference voltage of 4 V, then 4V/2=2V voltage source source should be connected to this pin hence, this pin has got the name Vref/2.



AGND:- This is analog ground pin where an ground of analog input source is connected. Similarly, in DGND which is referred to as digital ground, the ground of working voltage source of the MCU or ADC is connected.


D0-D7:- These are a 8-bit parallel data pins of ADC0804.


Only 4 control pins needed to control the ADC ie,CS,RD,WR,and INTR 
the prorgamming logic as follows.

1)  Make chip select (CS) signal low. 
 

2)  Make write (WR) signal low.

3)  Make chip select (CS) high.

4)  Wait for INTR pin to go low (means conversion ends).  

Once the conversion in ADC is done, the data is available in the output latch of the ADC - See more at: http://www.8051projects.net/adc-interfacing/adc0804-interfacing.php#sthash.spmMnJGS.dpuf

Once the conversion in ADC is done, the data is available in the output latch of the ADC . So to read the data fromthe internal register of the ADC to the output give the following control signls.


1)  Make chip select (CS) pin low.

2)  Make read (RD) signal low.

3)  Read the data from port where ADC is connected.

4) Make read (RD) signal high.

5) ·  Make chip select (CS) high.
Make read (RD) signal high.


Thats all, the data is available at the data pin of the  ADC. do it with fast or it given in a loop to time defendant input variation .

Program  ( 8051 used to give the control signal )
  This progarm only read the analog input signal and available at the data pin of ADC (DB0-DB7)
and in Proteus simulation that data Pin is connected to LED to check.
The program is written in Keil IDE.




#include <REGX51.H>
#define cs P0_0
#define rd P0_1
#define wr P0_2
#define intr P0_3

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

unsigned char adc_val;

void main()
{
    while (1) {                //Forever loop
    conv();                    //Start conversion
    read();                    //Read ADC

    }
}

void conv()
{
    cs = 0;                    //Make CS low
    wr = 0;                    //Make WR low
    wr = 1;                    //Make WR high
    cs = 1;                    //Make CS high
    while (intr);       //Wait for INTR to go low
}

void read()
{
    cs = 0;                    //Make CS low
    rd = 0;                    //Make RD low

    rd = 1;                    //Make RD high
    cs = 1;                    //Make CS high
}


 



Download here the Proteus and Keil File Clik here
 

C Programming With Ubuntu Tutorials

By

 C Programming With Ubuntu Tutorials       

       This tutorial is for those people who know how to program but doesn’t know how to run the C program in Linux. The linux itself is written in C programming which means it is very friendly to programmers. 

Our first program follows 
 



To write your First program Open your Terminal in ubuntu (Short Key -Alt+Ctrl+T). Enter the command there as follows
To Open Gedit (Text editor ) .
Sudo gedit myfirstprogram.c .
(give password it will open gedit and write program there and save it ,finally close that gedit) .




Once again .
1) Open the terminal & enter the command as folows.
  sudo gedit myfristprogram.c   
 Give password 
It will open a gedit text file with named as myfirstprogram.c .write here your first prgram source code here  save and close it .

2) Compile it the source code (myfirstprogram.c) by the following command
    gcc -o myfirstprogram myfirstprogram.c

3) To see the output type the command as follows 
  ./myfirstprogam 

In this case output is 

 Hello wrold   

 Thanks 





C Programming With Ubuntu Tutorials

By

 C Programming With Ubuntu Tutorials       

       This tutorial is for those people who know how to program but doesn’t know how to run the C program in Linux. The linux itself is written in C programming which means it is very friendly to programmers. 

Our first program follows 
 



To write your First program Open your Terminal in ubuntu (Short Key -Alt+Ctrl+T). Enter the command there as follows
To Open Gedit (Text editor ) .
Sudo gedit myfirstprogram.c .
(give password it will open gedit and write program there and save it ,finally close that gedit) .




Once again .
1) Open the terminal & enter the command as folows.
  sudo gedit myfristprogram.c   
 Give password 
It will open a gedit text file with named as myfirstprogram.c .write here your first prgram source code here  save and close it .

2) Compile it the source code (myfirstprogram.c) by the following command
    gcc -o myfirstprogram myfirstprogram.c

3) To see the output type the command as follows 
  ./myfirstprogam 

In this case output is 

 Hello wrold   

 Thanks 





C Programming Tutorials

By
The C Programming Language is an excellent choice for beginning programmers as well as for people who do not intend to become a programmer but just want the experience of creating a program.
Three things are necessary for creating C programs: a text editor, a compiler and a C standard library. A text editor is all that is needed to create the Source Code for a program in C or in any other language.  

A compiler is a specialized program that converts source code into machine language (also called object code or machine code) so that it can be understood directly by a CPU (central processing unit). An excellent C compiler is included in the GNU Compiler Collection (GCC). 

An integrated development environment (IDE) or interactive development environment is a software application that provides  all things (ie,a text editor, a compiler and a C standard library etc). There are a lot of IDE available with diffrent OS look here.


Available C compilers with Diffrent OS And IDE

-------------------------------------------------------------------------------------------------

CompilerAuthorWindowsUnix-likeOther OSsLicense typeIDE
AMPCAxiomatic Solutions Sdn BhdYesYesYesProprietaryYes
Aztec CManx Software SystemsNoNoYes CP/M, CP/M-86, MS-DOSProprietaryNo
Amsterdam Compiler KitAndrew Tanenbaum and Ceriel JacobsNoYesYesBSDNo
CCS C CompilerCCS, Inc.YesYesYesProprietaryYes
ChSoftIntegration, IncYesMac OS X, FreeBSD, Linux, Solaris, HP-UX, AIX, QnxYesFreewareYes — Professional and Student versions only
ClangLLVM ProjectYesYesYesBSDNo
CParser/libFirmMatthias Braun, Christoph Mallon and Michael BeckYesYesYesGPLNo
Digital MarsDigital MarsYesNoNo ?No
Dignus Systems/CDignus, L.L.CYes (host)Yes (host)Yes Z/ArchitectureProprietaryNo
GCC CGNU ProjectMingw, CygwinYesYes IBM mainframe, AmigaOS, VAX/VMS, RTEMSGPLNetBeans
IAR C/C++ CompilersIAR SystemsYesNoNoProprietaryYes
Interactive CKISS Institute for Practical RoboticsYesUnix, Mac, Linux, IRIX, Solaris, SunOSNoFreewareNo
LabWindows/CVINational InstrumentsYesYesYesProprietaryYes
lccChris Fraser and David HansonYesYesYesFreeware (source code available for non-commercial use)Windows only
Mark Williams CMark Williams CompanyYesCoherentYesProprietaryYes
Micro C Compiler (mcc)Roshan SnighYesYesYesFreeware (source code available for non-commercial use)No
MikroC CompilerMikroelektronikaYesYesYesProprietaryYes
NwccNils WellerNoYesNoBSDNo
Open64AMD SGI Google HP Intel Nvidia PathScale Tsinghua University and othersNoYesYesGPLNo
Open WatcomSybase and SciTech SoftwareYesYes LinuxYes OS/2, MS-DOSSybase Open Watcom Public LicenseYes Windows only?
Pelles CPelle OriniusYesNoNoFreewareYes
PGCCThe Portland GroupYesYes?ProprietaryYes — Visual Studio on Windows
Portable C CompilerStephen C. Johnson, Anders Magnusson and othersYesYesYesBSDNo
Power CMix SoftwareNoNoYesProprietaryNo
QuickCMicrosoftYesNoNoProprietaryYes
RCC (RCOR C Compiler)Rodrigo Caetano (rcor)YesYesNoGPLNo
Ritchie C Compiler (PDP-11)Dennis Ritchie and John Reiser; converted to cross-compiler by Doug GwynYesYesYesFreewareNo
SAS/CSAS InstituteYesYesYes IBM mainframe, AmigaOS, 68K, 88KProprietaryYes
Small-CRon Caine, James E. Hendrix, Byte magazineYesYesYes CP/M MS-DOSPublic DomainYes
Small Device C CompilerSandeep Dutta and othersYesYes?GPLNo
SubCNils M HolmMinGWFreeBSD, NetBSD, LinuxNoPublic DomainNo
Tiny C CompilerFabrice BellardYesYesNoLGPLNo
(Borland) Turbo CEmbarcaderoYesNoYesProprietary - V 2.01 freely availableYes
ups debugger (includes C interpreter)Tom Hughes, Ian Edwards, and othersNoYesYes Solaris, SunOSGPLYes
VBCCDr. Volker BarthelmannYesYesYesFreeware (source code available, modification not allowed)No
Visual C++ ExpressMicrosoftYesNoNoFreewareYes
XL CIBMNoAIX, LinuxNoProprietaryEclipse

-----------------------------------------------------------------------------------

 I am using ubuntu (Linux os) here is the compailer is GNU GCC
 Because linux is an open Source and can be rewrite ,edit etc ...  

................................................................ 

1.) Install GCC Compiler on you ubuntu  (Tutorial)
2.) Write First Program (that is called source code) as follows.(C programming with Ubuntu tutorials)



      (first Program) 
    #include<stdio.h>

    int main()
    {
    printf(“Hello World);
    return 0;
    }


 .....................................................
3.) Compiling the above program   .

.................
Find the result  Do these  2 or more times to understand and  by heart

 Next Tutorials

.........

More Posts

gElectron. Powered by Blogger.

Contributors

16x2 LCD Interfacing with STM32,STM32F103C6

 16x2 LCD  Interfacing with STM32,STM32F103C6 lcd_init(); LCD_LINE1; lcd_String(" GeElectron"); LCD_LINE2; lc...

Contact Form

Name

Email *

Message *

Contact us

Name

Email *

Message *

Follow Us

https://www.facebook.com/gElectron-393939667321867/ FBbox/https://www.facebook.com/IVYthemes

Comments

[blogger]

MKRdezign

Test

Latest

[recent][newsticker]

Technology

Top Ads

RECENT COMMENTS

Subscribe Via Email

Subscribe to our newsletter to get the latest updates to your inbox. ;-)


Your email address is safe with us!

RECENT COMMENTS