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 = {0x44, 0xFF, 0x00, 0x44, 0xAA, 0x00, 0xFF, 0xFF};
- uint8_t TAB_RAM[nLength];
- //---------------------------------------------------------------------
- int main (void)
- {
- DDRA = 0x00;
- DDRB = 0xFF;
- PORTA = 0x00;
- PORTB = 0xFF;
- //int i=0;
- //iterator
- while (PINA==0xFF)
- {
- }
- const uint8_t const* address = pgm_get_far_address(TAB_ROM[0]);
- while ( pgm_read_byte_far(address)!=0xFF || pgm_read_byte_far(address+1)!=0xFF)
- {
- PORTB=pgm_read_byte_far(address);
- address++;
- }
- //---------------------------------------------------------------------
- // 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
- // PORTA=0xFF
- // 2. Enable interrupts if needed
- // sei();
- // 3. Place here main code
- //----------------------------------------------------------------------
- // Program end
- //----------------------------------------------------------------------
- }
- // -------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement