Difference between revisions of "Switch and a LED with AVR"
Line 14: | Line 14: | ||
− | = | + | =Register Configuration = |
− | + | Please refer the below tutorial for basics of GPIO register configuration. | |
− | = | + | <html> |
− | + | <ul> | |
+ | <a href="https://www.exploreembedded.com/wiki/2._AVR_I/O_Register_Configuration">AVR I/O Register Configuration | ||
+ | </a> | ||
+ | </ul> | ||
+ | </html> | ||
− | + | =Code= | |
− | + | Below points needs to be considered for this example. | |
− | + | * Include the io.h file as it has the definitions for all the PORT registers. | |
− | <html>< | + | * Include delay.h file to use the delay functions. |
+ | * Configure the PORT as Output before writing any data to PORT pins. | ||
+ | <html> | ||
+ | <script src="https://gist.github.com/SaheblalBagwan/310b1582e0bec2ad28ad.js"></script> | ||
+ | </html> | ||
− | + | ==LEDs and Switches Wiring diagram== | |
− | + | <html><img src ="https://www.exploreembedded.com/blog/wp-content/uploads/img-collections/fritzing-tutorials_de69ccc2/switch_bb.png" width="670 px"></html> | |
− | + | ||
− | + | ||
− | <html><img src ="https://www.exploreembedded.com/blog/wp-content/uploads/img-collections/ | + | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | = | + | =Explore Ultra AVR Dev Kit= |
− | + | ||
The Explore Ultra AVR Kit comes with all the things required, not just for this experiment but for the entire series. And even if you think of migrating to PIC or Arduino, you'll have breakout boards that fit on to this, hence we believe it is a great investment for learning hands on Embedded Systems. The kit is fully open source, you may use the schematics, the design files and all of the source code and build something cool on your own. And when you do that do not forget to share with us what you've done. We would be happy to see you building something cool. | The Explore Ultra AVR Kit comes with all the things required, not just for this experiment but for the entire series. And even if you think of migrating to PIC or Arduino, you'll have breakout boards that fit on to this, hence we believe it is a great investment for learning hands on Embedded Systems. The kit is fully open source, you may use the schematics, the design files and all of the source code and build something cool on your own. And when you do that do not forget to share with us what you've done. We would be happy to see you building something cool. | ||
− | |||
<html> | <html> | ||
<ul> | <ul> | ||
Line 75: | Line 53: | ||
</html> | </html> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=Video Tutorial= | =Video Tutorial= |
Revision as of 15:48, 4 February 2016
Xplore007 (talk) 15:44, 4 February 2016 (IST)
Contents
Objective
After blinking the leds, its time control these leds depending on external inputs. In this tutorial we will interface a DIP switch to one of the Port's and display its status on LED's connected to other port.
Register Configuration
Please refer the below tutorial for basics of GPIO register configuration.
Code
Below points needs to be considered for this example.
- Include the io.h file as it has the definitions for all the PORT registers.
- Include delay.h file to use the delay functions.
- Configure the PORT as Output before writing any data to PORT pins.
LEDs and Switches Wiring diagram
Explore Ultra AVR Dev Kit
The Explore Ultra AVR Kit comes with all the things required, not just for this experiment but for the entire series. And even if you think of migrating to PIC or Arduino, you'll have breakout boards that fit on to this, hence we believe it is a great investment for learning hands on Embedded Systems. The kit is fully open source, you may use the schematics, the design files and all of the source code and build something cool on your own. And when you do that do not forget to share with us what you've done. We would be happy to see you building something cool.
- Explore Ultra AVR Dev Kit: Buy from EE Store
Video Tutorial
For those of you, who would like to watch instead of read we have made a video with all the gyan.