Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////////////////////////////////////////////
- // Laboratory AVR Microcontrollers Part1
- // Program template for lab 7
- // Authors:
- //
- // Group:
- // Section:
- //
- // Task:
- //
- // Todo:
- //
- //
- // Version: 3.0
- ;//////////////////////////////////////////////////////////////////////////////
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <avr/pgmspace.h>
- #define nLength 100
- const uint8_t const TAB_ROM[] PROGMEM = {0x01,0x02,0x03,0x04,0x05, 0x00, 0x00 };
- uint8_t TAB_RAM[nLength];
- //---------------------------------------------------------------------
- int main (void)
- {
- //---------------------------------------------------------------------
- // Main program code place here
- // 1. Place here code related to initialization of ports and interrupts
- // for instance:
- // port A as output and initial value 0
- DDRA=0xFF;
- PORTA=0x00;
- // port B as input and initial value FF
- DDRB=0x00;
- PORTB=0xFF;
- // 2. Enable interrupts if needed
- // sei();
- // 3. Place here main code
- int i = 0;
- while(1)
- {
- while(pgm_read_word(TAB_ROM+i) != 0x0000)
- {
- uint8_t a = pgm_read_byte(TAB_ROM+i);
- PORTB= a;
- i++;
- }
- }
- //----------------------------------------------------------------------
- // Program end
- //----------------------------------------------------------------------
- }
- // -------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement