473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ADC sampling

Hi,

I have a project where i need to use embedded C for the analog to digital conversion of a single signal. I want to sample the analog signal about 8 times a second and display the average output, my preferred microcontroller for use is the Atmega8. This will be my first project using C and microcontrollers.. My initial ideas are:

* To begin by defining the ADC as Port C
* Setting RES0 and RES1 as 1 for a reference voltage, ADC 0 as the input and then enabling ADEN.
* I can then produce an ADC_Sample class to instigate a delay of 265us for the first conversion and produce the output at ADCH, while incrementing the count (count++).
*The value of ADCH can go into another temporary register
* I can carry this out 7 more times with roughly 122ms delays between samples being taken with the count incrementing and the output at ADCH being added to the temporary register.
*When the count reaches 8 the temporary register can be divided by 8 and output at another appropriate register (I was thinking of using an if statement here).

These are only initial ideas, if anyone can offer a better solution to this problem or if my approach does not seem correct, please can you inform me and perhaps offer some tips on how this problem may be approached.

Any help or guidance given will certainly be appreciated!.Thanks!.
-B
Feb 4 '07 #1
2 1931
horace1
1,510 Expert 1GB
I tend to use dsPic devices but your approach sounds OK. Have you looked on the Atmel site?
http://www.atmel.com/dyn/products/devices.asp?family_id=607

in particular
http://www.atmel.com/dyn/products/product_card.asp?part_id=2004

also the embedded systems discussion group
http://www.embeddedrelated.com/groups.php
Feb 4 '07 #2
Thank you for your feedback,

Yes, I have looked at the Atmel site (in particular the datasheet for the microcontroller) and after much effort today, I am now pleased to say that I am making significant progress and have now written working code for two thirds of this stage of the project. All that remains is to set up an array for the sample values and make an average of the array elements. Once again thanks for the guidance I really appreciate it!.
-B
Feb 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Steven Bethard | last post by:
So, I have a list of lists, where the items in each sublist are of basically the same form. It looks something like: py> data = , .... .... , .... .... ] Now, I'd like to...
0
by: didifouke | last post by:
Hi, I try to sample and playback speech using snack. My idea is to have a socket based server that plays back the sound and a client that samples the input from the sound card and sends it to...
1
by: steflhermitte | last post by:
Dear cpp-ians, I want to apply a stratified sampling on an image. Following simplified example will explain my problem. The original image I with nrows and ncols is now a vector V of length...
1
by: Morgan Cheng | last post by:
Hi, I am curious that how sampling profiler works. How can a program(profiler) know the running detailis of another program? I googled this topic and not much info is got. Is there anybody get...
0
by: himanshu | last post by:
Hi i am one problem in my project. I want to do virtual sampling to convert jpg/png file swf. How is it possible? Is there ant tools by which is te possible?
4
by: kenfar | last post by:
I've got a large table on db2 8.2.1 that I rarely perform runstats on. It has about 600 million rows organized in a single MDC time dimension on a non-dpf warehouse. Anyhow, we recently ran...
0
by: Miloann | last post by:
Is there existing macros or functions that I can perform the following sampling logic? I have a file with 500K transactions. Would like to start with a number and select one transaction every...
1
by: helezem | last post by:
pls cud any one help me with a program that generates samples randomly using simple random sampling
0
by: Matei Zaharia | last post by:
I'm looking for a sampling profiler which I can attach to a running Python process without modifying the source code or affecting performance. So far I've only seen references to...
3
by: wizche | last post by:
Hi Everybody, I'm trying to play a little with waveIn functions... My goal is to calculate if I'm listening a specified sin frequency or not. For this reason I'm going down with the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.