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

help me in DAC using 89c4051

Sir, I am using 89c4051 to convert digital to analog. pin 1.0 and 1.1 are used, but I am confused how to us? please help me I don't know anything.

Parents Reply Children
  • DAC using 89c4051 alone using look up table. I am giving some input voltage say 4v as input to p1.1 mcu will compare with referecnce voltage and as soon as both the voltages become equal it will generate a flag... here in the program I need initiate start of conversion, how to write code in C for start conversion?

  • The reference voltage you talk about has to be provided by the microcontroller
    using some pins connected to an R/2R ladder or by an RC single slope or dual slop.

    ladder like this
    upload.wikimedia.org/.../420px-R2r-ladder.png

    each pin of the microcontroller sets a bit of the generated voltage
    ikalogic.cluster006.ovh.net/.../r2r-.jpg

    The output of this the ladder must be connected to P1.0
    (since the unknown input voltage is connected to to P1.1)

    The ladder method requires some more pins of the microcontroller but can
    give good precision and resolution if this occupies 7-10pins.

    The RC ADC method mentionted previously is charging(or discharging) a capacitor up
    to a level where the Analog Comparator gives a signal of the two compared voltages.
    www.atmel.com/.../doc0524.pdf

    The RC method uses only 5 pins and have a medium accuracy, but is easy to build.

    Both methods are about comparing an unknown voltage with a reference voltage
    and when the comparator gives the signal changes state the the unkown voltage
    is equal with the known voltage.

    So the algorithm is a continous loop where the ladder or the RC system is updated
    with new values and wait until the comparator signals the state change.

    The analog comparator has it own interrupt system for Enable, Priority, Flag, Vector.

    "The analog comparator is always disabled during Idle or Power-down modes"
    "The comparator operation is such that the output is a logical “1” when the positive
    input AIN0 (P1.0]) is greater than the negative input AIN1 (P1.1). Otherwise the output
    is a zero. Setting the CEN bit in ACSR enables the comparator."
    www.atmel.com/.../doc3390.pdf

  • ya, your are correct, mcu will provide the reference voltage. while designing we need to set the reference voltage. But the problem here is how to start the comparison? do i need to write software coding for that or it keeps on comparing? As you said we need to enable the comparator i.e set bit CEN of ACSR. but 89c4051 does not have ACSR. what to do? please help me bit in coding... help me in coding how to start comparing? using interrupt or enabling comparator? or any other metods? if you have code please post it

  • For the AT89C4051 microcontroller the output of analog comparator is defined as:
    "P3.6 is hard-wired as an input to the output of the on-chip comparator and is not accessible as a general-purpose I/O pin."
    www.atmel.com/.../doc1001.pdf

    The "next" model of AT89S4051 has the ACSR SFR (and PWM also)
    www.atmel.com/.../doc3390.pdf

  • Thank you sir, you helped me a lot.

  • Sir, mcu 89v51rd2 is not communicating serially. rs232 cable is working.
    mcu was communicating 4 days before, but now it is not communicating.. I have lost 2 mcu. what would be the problem?

  • Is this the same project with AT89C4051 with DAC/ADC or another one?
    Is there a problem in serial communication with another device ?
    Is there a problem with ISP ?
    Please describe the issue (mcu, board, connections), a "not working" is not enough.

  • The problem got resolved, now its working. I don't know exactly where the problem was. sometimes communication happens and sometimes it won't communicate...

    Thank you

  • mcu 89v51rd2 is not communicating serially. rs232 cable is working.
    mcu was communicating 4 days before, but now it is not communicating.. I have lost 2 mcu. what would be the problem?

    check that your MAX232(equivalent) is connected correctly.
    do not remember how, but remember it was the transciever connection

    Erik

  • The problem got resolved, now its working. I don't know exactly where the problem was.

    Then the problem has not been resolved. It's just gone away for now. But if you don't know what the problem was, then it cannot possibly have been resolved.