Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. /*
  2.  * Projekt1.c
  3.  *
  4.  * Created: 2014-10-13 13:42:50
  5.  *  Author: michbar055
  6.  */
  7.  
  8. #ifndef F_CPU
  9. #define F_CPU 1000000UL
  10. #endif
  11. #include <avr/io.h>
  12. #include <util/delay.h>
  13. #include <avr/pgmspace.h>
  14.  
  15. #define nLength 100
  16.  
  17. uint8_t const TAB_ROM[] PROGMEM = { 0x11, 0x00, 0x00 };
  18. uint8_t TAB_RAM[nLength];
  19.  
  20.  
  21. int main(void)
  22. {
  23.    
  24.     DDRA = 0x00;
  25.     PINA = 0XFF;
  26.    
  27.     DDRB = 0xFF;
  28.     PORTB = 0x00;
  29.     char byte;
  30.     int i;
  31.     for(i = 0; 1; i++)
  32.     {
  33.         if(!pgm_read_byte_far(&TAB_ROM[i]) && !pgm_read_byte_far(&TAB_ROM[i+1]))
  34.         {
  35.             break;
  36.         }
  37.         byte = pgm_read_byte_far(&TAB_ROM[i]);
  38.         PORTB = byte;
  39.         _delay_ms(1000);
  40.        
  41.     }
  42.    
  43.     PORTB = 0x00;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement