Connect with us

ADC

Discussion in 'Electronic Design' started by Prakruthi, Nov 16, 2006.

Scroll to continue with content
  1. Prakruthi

    Prakruthi Guest

    Could anybody tell me the best way to output the digital words from
    the ADC on to the hyperterminal. I seem to facing some problems with
    printf. Any other way?

    Thanks and regards,
    Prakruthi
     
  2. 1) how are you interfacing the ADC to hyperterminal
    2) what ADC is it?
    3) Most people say hyperterminal is not very good


    martin
     
  3. Guest

    Use serial communication. Got a serout routine?
     
  4. Donald

    Donald Guest

    Prakruthi,

    Are you a first year engineering student ?

    By your second year you should be able to do all the things you have
    asked about on your own.

    Please do some of your own homework.

    To help you out, go here: http://jfgi.us/

    donald
     
  5. Prakruthi

    Prakruthi Guest

    Hi Martin,

    I m interfacing the ADC to the hyperterminal thru a USB using the
    ATMega8 microcontroller
    I m using the AD7714

    The problem is that sometimes I dont see all three bytes of the digital
    word on the output.Its a little strange. But I dont know if the problem
    is with the printf only.

    Regards,
    Prakruthi
     
  6. Rich Grise

    Rich Grise Guest

    One possible way to check this is to temporarily not use printf(), but
    to format your own data and output it character by character with, say,
    putc(), or putch(), or whichever - you could look it up.

    Good Luck!
    Rich
     
  7. jasen

    jasen Guest

    what printf format string are you using?, what do you see?
     
  8. Prakruthi

    Prakruthi Guest

    @Jasen,

    I m using %d to print an unsigned char data. I m looking to see a
    digital word 3 bytes long. But sometimes I dont see all the three bytes
    , I fail to see where they disappear.

    Regards,
    Prakruthi
     
  9. Prakruthi

    Prakruthi Guest

    @Rich,

    Thanks Rich, Will try that out.Hope that helps.

    Thanks again.
    Regards,
    Prakruthi
     
  10. Er. If the value is below 100, then %d, will only give two digits. If it
    is below 10, %d, will only give one. You need to use %03d, which will give
    a three digit field, with leading zeros, to ensure that you actually get
    three digits each time.

    Best Wishes
     
  11. Arlet

    Arlet Guest

    Correct, but even then the results aren't really easy to read.

    If the 3 bytes from the ADC are in "h", "m" and "l", first convert them
    into a 'long' type:

    long val = ((long) h << 16) + ((long) m << 8) + (long) l;

    and then print this value with printf( "%ld", val );

    Or, if you insist on seeing the individual bytes for easier
    verification with bit patterns on scope, use something like "%02x",
    which prints each byte in 2 digit hex.
     
  12. Prakruthi

    Prakruthi Guest

    Roger Hamlett wrote:
    ..
    Thanks for the input Roger. Will try what you suggested. Hope it
    works:) Thanks again.

    Regards,
    Prakruthi
     
  13. Prakruthi

    Prakruthi Guest

    Hi Arlet,

    What you say makes a lot of sense. Thanks for the suggestion. Will try
    this and keep you posted on the results.

    Regards,
    Prakruthi
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-