How to make blink an LED using ATMEGA16

in DTube6 years ago


In this tutorial video, we're going to make two LEDs via ATMEGA16. The required programs are proteus professional 8 and AVR CodeVision. They are used together.
If you are familier with ATMEGA16, bit number 0 and bit number 8 of PORTD are used. it depend on you to choose which bit of a PORT. The period of blinking is 0.5s.
Let’s do it.

  • Open proteus 8 professional.
  • First pick up elements from library. (in the video you will see how pick up required elements step by step. don't be worried!!!)
  • LEDs are connected to related ports.
  • Connect serial every resistor to a LED.
  • Then open AVR codevision. Use wizard.
  • Open a new project. Select project.
  • In code wizard window, select “AT90.AT Tiny”.
  • In program tab select “preview” then select “generate, save and exit.”
  • Save the project.
    First of all you have to set initial value and data direction of ports.
    The statement “PORTD=0xXX;” indicates initial value of bits in PORT D.
    For example if bit-0 and bit-8 of PORTD are “1”, the BCD number for showing initial value of PORTD will be “81”.
    For example if all bits of PORTD are “1”, the BCD number for showing initial value of PORTD will be “FF”.
    DDRD means DATA DIRECTION of PORT D.
    If DDR of a bit is 1, it means that the port is input.
    If DDR of a bit is 0, it means that the port is output.
    In this example, we’re going to use PORTD.0 and PORTD.7 as output.
    Every port has 8 bits. If bit 0 and bit 8 is 1. the BCD number of port will be “81”. The BCD number of PORT D (1000 0001) will be “81”.
    As the result in the statement “DDRD=0x81;”, DDRD is equal to 0x81
    Bit 0 and bit 8 are outputs and the other bits are inputs.
    In the while loop place your code. We want to make blinked LEDs repetitive.
    Including delay.h library.
    Type #include <delay.h>
    In projet tab select “build all”.
    debugging!!!
    In proteus double click on ATMEGA16. download EXE file to ATMEGA16. Click on play.
    you did it!!!

▶️ DTube
▶️ BTFS
Sort:  

Congratulations @asgeng! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You received more than 600 upvotes. Your next target is to reach 700 upvotes.

You can view your badges on your board And compare to others on the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @hivebuzz:

Hive Whale - Make it spray and get your badge!
Support the HiveBuzz project. Vote for our proposal!