ADC

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

Reply to
Prakruthi
Loading thread data ...

1) how are you interfacing the ADC to hyperterminal 2) what ADC is it? 3) Most people say hyperterminal is not very good

martin

Reply to
martin griffith

Use serial communication. Got a serout routine?

Reply to
sdeyoreo

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:

formatting link

donald

Reply to
Donald

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

Reply to
Prakruthi

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

Reply to
Rich Grise

what printf format string are you using?, what do you see?

--
Bye.
   Jasen
 Click to see the full signature
Reply to
jasen

@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

Reply to
Prakruthi

@Rich,

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

Thanks again. Regards, Prakruthi

Reply to
Prakruthi

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

Reply to
Roger Hamlett

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

Reply to
Arlet

Roger Hamlett wrote: .

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

Regards, Prakruthi

Reply to
Prakruthi

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

Reply to
Prakruthi

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.