test._c

来自「用ICC编写的程序包括SPI」· _C 代码 · 共 66 行

_C
66
字号
//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,10};
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 + =
减小字号Ctrl + -
显示快捷键?