This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem: C51 with 12-bit Serial ADC MAX187

I am using uVision3 with AT89S52
and 89S52 is connected with 12-bit Serial ADC MAX187 according to Datasheet.
I have interfacing problem with this ADC using C51 compiler.
I searched uVision help and net also, but didn't find any solution.
So please Reply in Detail. and don't tell me to goto http://www.atmel.com or http://www.maxim-ic.com because i already searched there for any example.

Problems are:
1. How can i store A/D Converted value (12bit) to one 16bit register for 89S52 ,or using two registers?
2. I can use "ACC" for 8 bit rotation but how i will store 8-bit ACC data to any register or Variable so i can print to LCD.
3. Can i use DATA,BDATA,IDATA and PBYTE,CWORD,DWORD,PWORD from absacc.h ?
4. How can i convert 12bit binary to ASCII? so i can print to LCD.

Parents
  • In your program if i assigns sbit DOUT=P1^1;
    then how will i link to data of DOUT to shift_reg
    because DOUT is a single bit and shift_reg is an integer.

    Please Explain !
    


    I think this can be done easily in assembly by using of registers but i want easily with C

    unsigned int shift_reg;
    
    shift_reg = 0;
    
    for (i = 12; i != 0; i--) {
        Take SCLK high;
        shift_reg <<= 1;
        Take SCLK low;
        if (DOUT)
            shift_reg |= 1;
    }
    
    

Reply
  • In your program if i assigns sbit DOUT=P1^1;
    then how will i link to data of DOUT to shift_reg
    because DOUT is a single bit and shift_reg is an integer.

    Please Explain !
    


    I think this can be done easily in assembly by using of registers but i want easily with C

    unsigned int shift_reg;
    
    shift_reg = 0;
    
    for (i = 12; i != 0; i--) {
        Take SCLK high;
        shift_reg <<= 1;
        Take SCLK low;
        if (DOUT)
            shift_reg |= 1;
    }
    
    

Children
No data