
Добавил:
Andrejjavd
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Примеры решения лабораторных работ / Лаба3
.txt//ICC-AVR application builder : 15.02.2021 11:15:10
// Target : M8535
// Crystal: 8.0000Mhz
#include <iom8535v.h>
#include <macros.h>
#include <io2313v.h>
#include <stdio.h>
void port_init(void)
{
PORTD = 0x00;
DDRD = 0xff;
}
//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
MCUCR = 0x00;
GICR = 0x00;
TIMSK = 0x00; //timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialized
}
void Delay(int i)
{
unsigned int p;
for (p=0;p<i;p++)
{
int tiks=1000000;
while (tiks>0)
tiks--;
}
}
//
void main(void)
{
int t[9]={0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
int i=0;
init_devices();
while (1)
{
PORTD=t[i];
Delay(4);
i++;
if (i>=8)
i=0;
}
//insert your functional code here...
}
Соседние файлы в папке Примеры решения лабораторных работ