Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. /*
  2.  * 7 SEGMENT.c
  3.  *
  4.  * Created: 23.9.2019 11:41:50
  5.  * Author : PC
  6.  */
  7.  
  8. #define AVR_ATmega16 1
  9. #define F_CPU 8000000UL
  10.  
  11. #include <avr/io.h>
  12. #include <util/delay.h>
  13.  
  14. int main(void)
  15. {
  16.     /* Replace with your application code */
  17.  unsigned char tab[5]=
  18.  {
  19.      0b11111111, //index 0
  20.      0b01111110, //index 1
  21.      0b00111100, //index 2
  22.      0b00011000, //index 3
  23.      0b00000000, //index 4
  24.    
  25.    
  26.    
  27.     DDRC=0b11111111;
  28.     PORTC=0b11111111;
  29.    
  30.     while (1)
  31.     {
  32.    unsigned char index;
  33.    for (index=0; index<=4; index++);
  34.    
  35.    {
  36.     PORTC=tab[index]; //výběr kombinace a odeslání
  37.     _delay_ms(500);   //prodleva
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement