<xml xmlns="https://developers.google.com/blockly/xml">
<description>
<![CDATA[

## PWM control for LED Brightness adjustment


<img class="ui image fluid" src='data:image/jpeg;base64,[encoded data, 94424 characters]'/>

## Configuring PWM with TCCR0 register


The following bits control the various parameters of this Timer/Counter feature

<img class = "ui image fluid" src='data:image/png;base64,[encoded data, 13600 characters]'/>

We have set the bits 6, 5 , 3, and 0 to HIGH. The functions of each bit are explained in the datasheet of the ATMEGA32 microcontroller used in KuttyPy

### Bit 6, 3 – WGM01:0: Waveform Generation Mode

<img class = "ui image fluid" src='data:image/png;base64,[encoded data, 32168 characters]'/>

These bits control the counting sequence of the counter, the source for the maximum (TOP)
counter value, and what type of Waveform Generation to be used. Modes of operation sup-
ported by the Timer/Counter unit are: Normal mode, Clear Timer on Compare Match (CTC)
mode, and two types of Pulse Width Modulation (PWM) modes. We have selected mode 3(Fast PWM) since both bits are set.

### Bit 5:4 – COM01:0: Compare Match Output Mode

<img class = "ui image fluid" src='data:image/png;base64,[encoded data, 29352 characters]'/>

These bits control the Output Compare pin (OC0) behavior. If one or both of the COM01:0 bits
are set, the OC0 output overrides the normal port functionality of the I/O pin it is connected to.
However, note that the Data Direction Register (DDR) bit corresponding to the OC0 pin must be
set in order to enable the output driver.

When OC0 is connected to the pin, the function of the COM01:0 bits depends on the WGM01:0
bit setting. Table 39 shows the COM01:0 bit functionality when the WGM01:0 bits are set to a
normal or CTC mode (non-PWM).


### 

<img class = "ui image fluid" src='data:image/png;base64,[encoded data, 47420 characters]'/>

The three Clock Select bits select the clock source to be used by the Timer/Counter.




]]>
</description>

 <block type="set_reg_bits" id="F.-|[ZB)k9nqSe+{QD_i" x="0" y="0">
        <field name="REGISTER">DDRD</field>
        <field name="B7">TRUE</field>
        <field name="B6">FALSE</field>
        <field name="B5">TRUE</field>
        <field name="B4">FALSE</field>
        <field name="B3">FALSE</field>
        <field name="B2">FALSE</field>
        <field name="B1">FALSE</field>
        <field name="B0">FALSE</field>
        <next>
          <block type="set_reg_bits" id="G5QT5+hgKr#s;^oSB10e">
            <field name="REGISTER">PORTD</field>
            <field name="B7">TRUE</field>
            <field name="B6">FALSE</field>
            <field name="B5">TRUE</field>
            <field name="B4">FALSE</field>
            <field name="B3">FALSE</field>
            <field name="B2">FALSE</field>
            <field name="B1">FALSE</field>
            <field name="B0">FALSE</field>
            <next>
              <block type="set_reg_bits" id="mOB!sm:?QAP/i%dL.%gj">
                <field name="REGISTER">DDRB</field>
                <field name="B7">FALSE</field>
                <field name="B6">FALSE</field>
                <field name="B5">FALSE</field>
                <field name="B4">FALSE</field>
                <field name="B3">TRUE</field>
                <field name="B2">FALSE</field>
                <field name="B1">FALSE</field>
                <field name="B0">FALSE</field>
                <next>
                  <block type="set_reg_bits_string" id="c,(i4=(k.!/7e%CL^Nmd">
                    <field name="REGISTER">TCCR0</field>
                    <field name="B7">FALSE</field>
                    <field name="B6">TRUE</field>
                    <field name="B5">TRUE</field>
                    <field name="B4">FALSE</field>
                    <field name="B3">TRUE</field>
                    <field name="B2">FALSE</field>
                    <field name="B1">FALSE</field>
                    <field name="B0">TRUE</field>
                    <next>
                      <block type="controls_whileUntil" id="3_-/zG;*b(MPH$),#8u0">
                        <field name="MODE">WHILE</field>
                        <value name="BOOL">
                          <block type="logic_boolean" id="}L/Mbp=*iw]iSu]G6UX3">
                            <field name="BOOL">TRUE</field>
                          </block>
                        </value>
                        <statement name="DO">
                          <block type="set_reg_from_string" id="7vh^(]x@Oz^rtuj%W(?}">
                            <field name="REGISTER">OCR0</field>
                            <value name="VALUE">
                              <shadow type="math_number" id=")sZs5W)=YMI{NV_$k,OX">
                                <field name="NUM">0</field>
                              </shadow>
                              <block type="get_phone_light" id="w$1f#H#iU#Ubm*QKXW67">
                                <field name="CHANNEL">0</field>
                              </block>
                            </value>
                            <next>
                              <block type="plot_datapoint" id="ZS0SnelKxR)eh{(u-}Y7">
                                <value name="YAXIS">
                                  <shadow type="text" id="(Y5k|W`Cf5oAp[p9dHmj">
                                    <field name="TEXT">Y-Axis</field>
                                  </shadow>
                                </value>
                                <value name="VALUE">
                                  <block type="get_phone_light" id="6txcLq=bg^[VF:FTu3j}">
                                    <field name="CHANNEL">0</field>
                                  </block>
                                </value>
                                <next>
                                  <block type="wait_seconds" id="$5*eA~Z%}Il@c.:PIxv+">
                                    <field name="SECONDS">0.01</field>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </statement>
                      </block>
                    </next>
                  </block>
                </next>
			  </block>
            </next>
          </block>
        </next>
      </block>
    </xml>
