P89v51rd2 Interface With Adc Mcp3202


Posted on Feb 7, 2014

In this interface session we are interface mcp3202 adc interface with 8051 microcontroller. Mcp3202 is a 12bit spi protocol adc, is interface with P89v51rd2 microcontroller,this microcontroller have spi protocol so no need to worry about SDI,SDO,CLCK. Interface mcp3202 to 8051 microcontroller CS is P2.2 and MOSI is connected to P1.5 and MISO is P1.6, SCK is P1.7 refer the P89v51rd2 datasheet and MCP3202 datasheet.In this session our kit LCD P0 is for Data and P3.6 is R/s Register Select and P3.7 is for E/N Enable pin.You have interface these adc is very easy just copy we code and compile using keil or Ride compiler without no errors. U have to only P89v51rd2 compiler because the spi protocol library function is there in the header file.


P89v51rd2 Interface With Adc Mcp3202
Click here to download the full size of the above Circuit.
P89v51rd2 Interface With Adc Mcp3202 - image 1
Click here to download the full size of the above Image.

In this session our kit LCD P0 is for Data and P3. 6 is R/s Register Select and P3. 7 is for E/N Enable pin. You have interface these adc is very easy just copy we code and compile using keil or Ride compiler without no errors. U have to only P89v51rd2 compiler because the spi protocol library function is there in the header file. #include "p89v51rd2. h" #include "stdio. h" #include "string. h" #define LCD_clear() LCD_command(0x01) /* Clear display LCD */ #define LCD_origin() LCD_command(0x02) /* Set to origin LCD */ #define LCD_row1() LCD_command(0x80) /* Begin at Line 1 */ #define LCD_row2() LCD_command(0xC0) sbit rs = P36; sbit en = P37; sbit cs = P22; void delay (); void display(int name1); void spi (); // <7465> *// void lcd_en () { // rw=0; en = 1; en = 1; en = 1; en = 0; en = 0; } void LCD_delay(unsigned char ms) { unsigned int n; unsigned int i; for (n=0; n { for (i=0; i<1535; i+); /* For 1 ms */ } } void LCD_command(unsigned char command) { rs=0; rs = 0; P0 = command; lcd_en (); LCD_delay(1); } void LCD_init() { LCD_command(0x38); LCD_command(0x06); LCD_command(0x0c); LCD_command(0x01); } void LCD_putc(unsigned char ascii) { rs=1; P0 = ascii; lcd_en (); LCD_delay(2); } void LCD_puts(unsigned char *lcd_string) { while (*lcd_string) { LCD_putc(*lcd_string+); } } void display(int name1) //LCD display routine for digits display { rs = 1; P0 = name1; lcd_en(); LCD_delay(10); }...





Leave Comment

characters left:

Related Circuits

  • New Circuits

    .

     


    Popular Circuits

    2x 2,500W RMS stereo amplifier
    Thumbwheel programmable interval timer
    Arduino Midi
    cdmp3 cd with cdroom circuit diagram
    1999 suburban: head lights checked fuses owners manual headlamps
    Simple GPS Disciplined Reference
    SI ABBREVIATION DISPLAY
    UGN-3501T counter circuit diagram of a Hall sensor



    Top