📄 test.c
字号:
//ICC-AVR application builder : 2005-2-20 上午 10:39:44
// Target : M16
// Crystal: 8.0000Mhz
#include <iom16v.h>
#include <macros.h>
void port_init(void)
{
PORTA = 0xFF;
DDRA = 0x00;
PORTB = 0xFF;
DDRB = 0x00;
PORTC = 0xFF; //m103 output only
DDRC = 0x00;
PORTD = 0xFF;
DDRD = 0x00;
}
#pragma interrupt_handler int0_isr:2
void int0_isr(void)
{
//external interupt on INT0
}
#pragma interrupt_handler int1_isr:3
void int1_isr(void)
{
//external interupt on INT1
}
//call this routine to initialise all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
MCUCR = 0x00;
GICR = 0xC0;
TIMSK = 0x00; //timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialised
}
const struct p{
unsigned char t1;
unsigned int t2;
};
struct p a1={10,1000};
struct p *pa1=&a1;
void main()
{unsigned char t=a1.t1;
unsigned int te=a1.t2;
unsigned char test[4]={0,0,0,0};
unsigned char *pc=(unsigned char *)(&a1);
test[0]=*pc++;
test[1]=*pc++;
test[2]=*pc++;
init_devices();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -