Line 4: Line 4:
 
=Hookup=
 
=Hookup=
 
=Code=
 
=Code=
 +
<html>
 +
<script src="https://gist.github.com/vaibhavkatkar18/42b0a1f6ab727b655654698a5fe7f752.js"></script>
 +
 +
</html>
 +
 
=Demo=
 
=Demo=
 
[[file:0_7Segment_Starter_AVR.gif]]
 
[[file:0_7Segment_Starter_AVR.gif]]
  
 
=Downloads=
 
=Downloads=

Revision as of 11:13, 5 April 2016


Basic

Hookup

Code

#include <avr/io.h>
#include <util/delay.h>
#define Segment 0x01
int main() {
char seg_code[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
int cnt;
/* Configure the ports as output */
DDRB = 0xff; // Data lines
DDRD = 0x01; // Control signal PORTD0
while (1)
{
for (cnt = 0x00; cnt < 0x10; cnt++) // loop to display 0-F
{
PORTD = Segment;
PORTB = seg_code[cnt];
_delay_ms(300);
}
}
}
view raw 7Segment.c hosted with ❤ by GitHub

Demo

0 7Segment Starter AVR.gif

Downloads