We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Dear all,
I am using C programming and C8051F206 board. Currently, I am able to display the 12 bit data value on my alphanumeric LCD. What should i be looking at to store, say 10 discrete values from a sine wave signal with sampling frequency of 1Hz ?
Thanks.
I really don't understand exactly what you are asking about.
To store 10 12-bit samples, you would normally use a 10-entry array of short int, but there must really be something else you are wondering about...
"I really don't understand exactly what you are asking about."
Exactly.
If you can read one value, then reading ten values is simply a matter of repeating it ten times!
An array, and using a loop to do the repetition, would be the obvious choice; but you could just hard-code it as ten separate reads to ten distinct variables.
To set the sampling frequency, you just put a delay between reads.
So what is the real difficulty?
Do you want to read continuously, and just keep the ten most recent values? If so, a Ring Buffer would be ideal...
Note that the above is all entirely generic - not specific to Keil or the 8051...