Skip to content
Snippets Groups Projects
Commit f9a2f515 authored by Ahmad Fares's avatar Ahmad Fares
Browse files

-m updating C-programming

parent 761d0920
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -229,7 +229,8 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
</tbody>
</table>
<p>64 prescalar gives 4.194304 seconds, using the rule of third, I have calculated the number corresponds to 1 second as follows</p>
<p>4.194304 --&gt; 65536 1 ---------&gt; X</p>
<p>4.194304 --&gt; 65536</p>
<p>1 ---------&gt; X</p>
<p>X = 65536/4.194304 = 15625 exact.</p>
<h4 id="example">Example</h4>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="co">/*</span>
......@@ -267,6 +268,9 @@ ISR(TIM1_COMPA_vect){
}
}</code></pre></div>
<h2 id="adc">ADC</h2>
<p>Until now, I have been dealing with digital inputs and outputs, it was easy and direct since the microcontroller is a digital device which understands only 0 and 1, but when analog sensors and signals are needed then the analog to digital converter should be used.</p>
<p>ADC is an integrated hardware which converts the analog signals to discrete digital values. In my case, the attiny44 has a 10 bit ADC which converts the voltage range read by the input pin to a corresponding value ranging from 0 to 1023.</p>
<p>There two operating modes for the ADC, single conversion and free running. The single conversion mode requires the user to initiate each conversion process whereas free running mode keeps doing the conversion process automatically. I have used free running mode as it makes ADC easier.</p>
<h2 id="sample-code.">Sample Code.</h2>
<p><strong>In sample code put also problems see notebook</strong></p>
<p><strong>Write more about registers in interrupt and other</strong></p>
......
......@@ -215,6 +215,7 @@ First is choose the first prescalar which gives a time higher than the required
64 prescalar gives 4.194304 seconds, using the rule of third, I have calculated the number corresponds to 1 second as follows
4.194304 --> 65536
1 ---------> X
X = 65536/4.194304 = 15625 exact.
......@@ -261,6 +262,14 @@ while(1) {
## ADC
Until now, I have been dealing with digital inputs and outputs, it was easy and direct since the microcontroller is a digital device which understands only 0 and 1, but when analog sensors and signals are needed then the analog to digital converter should be used.
ADC is an integrated hardware which converts the analog signals to discrete digital values. In my case, the attiny44 has a 10 bit ADC which converts the voltage range read by the input pin to a corresponding value ranging from 0 to 1023.
There two operating modes for the ADC, single conversion and free running. The single conversion mode requires the user to initiate each conversion process whereas free running mode keeps doing the conversion process automatically. I have used free running mode as it makes ADC easier.
## Sample Code.
**In sample code put also problems see notebook**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment